cozy-sharing 21.2.1 → 21.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [21.2.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@21.2.1...cozy-sharing@21.2.2) (2025-02-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **Sharing:** Show all share recipients in the “who has access” modal ([8669e6b](https://github.com/cozy/cozy-libs/commit/8669e6b8d8650bbd6645a9be94db403121059e70))
12
+ * **Sharing:** Show correct sharing status by user ([55f5a43](https://github.com/cozy/cozy-libs/commit/55f5a43ca5426da991ab76c7f96faa6ccae00a11))
13
+
14
+
15
+ ### Reverts
16
+
17
+ * Revert "fix(Sharing): Show correct sharing status by user" ([547a458](https://github.com/cozy/cozy-libs/commit/547a458b1dc4cb64724345c753eff153f7830a8a))
18
+
19
+
20
+
21
+
22
+
6
23
  ## [21.2.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@21.2.0...cozy-sharing@21.2.1) (2025-01-28)
7
24
 
8
25
  **Note:** Version bump only for package cozy-sharing
@@ -26,7 +26,8 @@ var MemberRecipientLite = function MemberRecipientLite(_ref) {
26
26
  t = _useI18n.t;
27
27
 
28
28
  var client = useClient();
29
- var isMe = isOwner && recipient.status === 'owner' || recipient.instance === client.options.uri;
29
+ var recipientOwner = recipient.status === 'owner';
30
+ var isMe = isOwner && recipientOwner || recipient.instance === client.options.uri;
30
31
  return /*#__PURE__*/React.createElement(ListItem, {
31
32
  size: "small",
32
33
  ellipsis: true
@@ -46,7 +47,7 @@ var MemberRecipientLite = function MemberRecipientLite(_ref) {
46
47
  }), /*#__PURE__*/React.createElement(Typography, {
47
48
  className: "u-flex-shrink-0",
48
49
  variant: "body2"
49
- }, isMe ? t("Share.status.".concat(recipient.status)).toLowerCase() : t("Share.type.".concat((_recipient$type = recipient.type) !== null && _recipient$type !== void 0 ? _recipient$type : 'one-way')).toLowerCase()));
50
+ }, recipientOwner ? t("Share.status.".concat(recipient.status)).toLowerCase() : t("Share.type.".concat((_recipient$type = recipient.type) !== null && _recipient$type !== void 0 ? _recipient$type : 'one-way')).toLowerCase()));
50
51
  };
51
52
 
52
53
  MemberRecipientLite.propTypes = {
@@ -28,6 +28,14 @@ export var EditableSharingModal = function EditableSharingModal(_ref) {
28
28
  revokeSelf = _useSharingContext.revokeSelf,
29
29
  share = _useSharingContext.share;
30
30
 
31
+ var shareFileRefId = hasSharedParent(document.path) ? document.dir_id : document._id;
32
+ var recipients = getRecipients(shareFileRefId);
33
+ var permissions = getDocumentPermissions(shareFileRefId);
34
+ var link = getSharingLink(shareFileRefId);
35
+ var sharing = getSharingForSelf(shareFileRefId);
36
+
37
+ var _isOwner = isOwner(shareFileRefId);
38
+
31
39
  return /*#__PURE__*/React.createElement(ShareModal, _extends({
32
40
  createContact: function createContact(contact) {
33
41
  return client.create(Contact.doctype, contact);
@@ -36,14 +44,14 @@ export var EditableSharingModal = function EditableSharingModal(_ref) {
36
44
  documentType: documentType,
37
45
  hasSharedChild: documentPath && hasSharedChild(documentPath),
38
46
  hasSharedParent: documentPath && hasSharedParent(documentPath),
39
- isOwner: isOwner(document.id),
40
- link: getSharingLink(document.id),
47
+ isOwner: _isOwner,
48
+ link: link,
41
49
  onRevoke: revoke,
42
50
  onRevokeSelf: revokeSelf,
43
51
  onShare: share,
44
- permissions: getDocumentPermissions(document.id),
45
- recipients: getRecipients(document.id),
46
- sharing: getSharingForSelf(document.id)
52
+ permissions: permissions,
53
+ recipients: recipients,
54
+ sharing: sharing
47
55
  }, rest));
48
56
  };
49
57
  EditableSharingModal.propTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "21.2.1",
3
+ "version": "21.2.2",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -78,5 +78,5 @@
78
78
  "sideEffects": [
79
79
  "*.css"
80
80
  ],
81
- "gitHead": "c5d78b5a602b3ec4f195ce1e80b717bb755d3f1a"
81
+ "gitHead": "b257fb0f869d9797d5222aa8481e7035a890aeb4"
82
82
  }
@@ -18,9 +18,9 @@ const MemberRecipientLite = ({ recipient, isOwner, ...props }) => {
18
18
  const { t } = useI18n()
19
19
  const client = useClient()
20
20
 
21
+ const recipientOwner = recipient.status === 'owner'
21
22
  const isMe =
22
- (isOwner && recipient.status === 'owner') ||
23
- recipient.instance === client.options.uri
23
+ (isOwner && recipientOwner) || recipient.instance === client.options.uri
24
24
 
25
25
  return (
26
26
  <ListItem size="small" ellipsis>
@@ -43,7 +43,7 @@ const MemberRecipientLite = ({ recipient, isOwner, ...props }) => {
43
43
  }
44
44
  />
45
45
  <Typography className="u-flex-shrink-0" variant="body2">
46
- {isMe
46
+ {recipientOwner
47
47
  ? t(`Share.status.${recipient.status}`).toLowerCase()
48
48
  : t(`Share.type.${recipient.type ?? 'one-way'}`).toLowerCase()}
49
49
  </Typography>
@@ -26,6 +26,15 @@ export const EditableSharingModal = ({ document, ...rest }) => {
26
26
  share
27
27
  } = useSharingContext()
28
28
 
29
+ const shareFileRefId = hasSharedParent(document.path)
30
+ ? document.dir_id
31
+ : document._id
32
+ const recipients = getRecipients(shareFileRefId)
33
+ const permissions = getDocumentPermissions(shareFileRefId)
34
+ const link = getSharingLink(shareFileRefId)
35
+ const sharing = getSharingForSelf(shareFileRefId)
36
+ const _isOwner = isOwner(shareFileRefId)
37
+
29
38
  return (
30
39
  <ShareModal
31
40
  createContact={contact => client.create(Contact.doctype, contact)}
@@ -33,14 +42,14 @@ export const EditableSharingModal = ({ document, ...rest }) => {
33
42
  documentType={documentType}
34
43
  hasSharedChild={documentPath && hasSharedChild(documentPath)}
35
44
  hasSharedParent={documentPath && hasSharedParent(documentPath)}
36
- isOwner={isOwner(document.id)}
37
- link={getSharingLink(document.id)}
45
+ isOwner={_isOwner}
46
+ link={link}
38
47
  onRevoke={revoke}
39
48
  onRevokeSelf={revokeSelf}
40
49
  onShare={share}
41
- permissions={getDocumentPermissions(document.id)}
42
- recipients={getRecipients(document.id)}
43
- sharing={getSharingForSelf(document.id)}
50
+ permissions={permissions}
51
+ recipients={recipients}
52
+ sharing={sharing}
44
53
  {...rest}
45
54
  />
46
55
  )