cozy-sharing 36.2.1 → 36.3.0

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,12 @@
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
+ # [36.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@36.2.1...cozy-sharing@36.3.0) (2026-07-01)
7
+
8
+ ### Features
9
+
10
+ - **cozy-sharing:** Hide email for org instance owner ([5d15a29](https://github.com/cozy/cozy-libs/commit/5d15a297a485e98ff6c0e3afe7ab466d9bf4fe99))
11
+
6
12
  ## [36.2.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@36.2.0...cozy-sharing@36.2.1) (2026-06-30)
7
13
 
8
14
  **Note:** Version bump only for package cozy-sharing
@@ -47,7 +47,10 @@ jest.mock('../../hooks/useSharingContext', function () {
47
47
  getSharedParentPath: jest.fn().mockReturnValue(null),
48
48
  getSharingById: mockGetSharingById,
49
49
  hasSharedChild: mockHasSharedChild,
50
- hasSharedParent: mockHasSharedParent
50
+ hasSharedParent: mockHasSharedParent,
51
+ isOrgSharedDrive: jest.fn(function () {
52
+ return false;
53
+ })
51
54
  };
52
55
  }
53
56
  };
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- var _excluded = ["instance", "isOwner", "status", "recipientConfirmationData", "verifyRecipient", "fadeIn"];
2
+ var _excluded = ["instance", "isOwner", "status", "recipientConfirmationData", "verifyRecipient", "fadeIn", "isOrgSharedDrive"];
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import { useClient } from 'cozy-client';
@@ -32,6 +32,7 @@ var MemberRecipient = function MemberRecipient(props) {
32
32
  recipientConfirmationData = props.recipientConfirmationData,
33
33
  verifyRecipient = props.verifyRecipient,
34
34
  fadeIn = props.fadeIn,
35
+ isOrgSharedDrive = props.isOrgSharedDrive,
35
36
  rest = _objectWithoutProperties(props, _excluded);
36
37
 
37
38
  var isMe = isOwner && status === 'owner' || instance === client.options.uri;
@@ -59,7 +60,8 @@ var MemberRecipient = function MemberRecipient(props) {
59
60
  isMe: isMe,
60
61
  instance: instance,
61
62
  email: rest.email,
62
- name: rest.name || rest.public_name
63
+ name: rest.name || rest.public_name,
64
+ isOrgSharedDrive: isOrgSharedDrive
63
65
  })
64
66
  }), RightPart));
65
67
  };
@@ -69,6 +71,7 @@ MemberRecipient.propTypes = {
69
71
  isOwner: PropTypes.bool,
70
72
  status: PropTypes.string,
71
73
  recipientConfirmationData: PropTypes.object,
72
- verifyRecipient: PropTypes.func
74
+ verifyRecipient: PropTypes.func,
75
+ isOrgSharedDrive: PropTypes.bool
73
76
  };
74
77
  export default MemberRecipient;
@@ -10,6 +10,7 @@ var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
10
10
  instance = _ref.instance,
11
11
  email = _ref.email,
12
12
  name = _ref.name,
13
+ isOrgSharedDrive = _ref.isOrgSharedDrive,
13
14
  typographyProps = _ref.typographyProps;
14
15
 
15
16
  var _useI18n = useI18n(),
@@ -24,7 +25,8 @@ var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
24
25
  // (getDisplayName falls back to email when the recipient has no name).
25
26
  // Keep the instance visible when there is no email at all, so the user
26
27
  // can still tell the recipient lives on a different Cozy instance.
27
- text = isMe || name || !email ? email || instance : '';
28
+ // For org shared drive owners, hide the email and instance entirely.
29
+ text = status === 'owner' && isOrgSharedDrive ? '' : isMe || name || !email ? email || instance : '';
28
30
  } else if (isSendingEmail) {
29
31
  text = t('Share.status.mail-not-sent');
30
32
  } else {
@@ -44,6 +46,7 @@ MemberRecipientStatus.propTypes = {
44
46
  instance: PropTypes.string,
45
47
  email: PropTypes.string,
46
48
  name: PropTypes.string,
49
+ isOrgSharedDrive: PropTypes.bool,
47
50
  typographyProps: PropTypes.object
48
51
  };
49
52
  export default MemberRecipientStatus;
@@ -63,39 +63,53 @@ describe('MemberRecipientStatus component', function () {
63
63
 
64
64
  expect(getByText('owner@example.com')).toBeTruthy();
65
65
  });
66
- it('should show "Sending invitation mail..." when status is mail-not-sent and not isMe', function () {
66
+ it('should hide email and instance when status is owner and isOrgSharedDrive is true', function () {
67
67
  var _setup6 = setup({
68
+ status: 'owner',
69
+ isMe: false,
70
+ email: 'org@example.com',
71
+ instance: 'foo.mycozy.cloud',
72
+ name: 'Org Owner',
73
+ isOrgSharedDrive: true
74
+ }),
75
+ queryByText = _setup6.queryByText;
76
+
77
+ expect(queryByText('org@example.com')).toBe(null);
78
+ expect(queryByText('foo.mycozy.cloud')).toBe(null);
79
+ });
80
+ it('should show "Sending invitation mail..." when status is mail-not-sent and not isMe', function () {
81
+ var _setup7 = setup({
68
82
  status: 'mail-not-sent',
69
83
  isMe: false
70
84
  }),
71
- getByText = _setup6.getByText;
85
+ getByText = _setup7.getByText;
72
86
 
73
87
  expect(getByText('Sending invitation mail...')).toBeTruthy();
74
88
  });
75
89
  it('should show "Invitation sent" when status is pending', function () {
76
- var _setup7 = setup({
90
+ var _setup8 = setup({
77
91
  status: 'pending',
78
92
  isMe: false
79
93
  }),
80
- getByText = _setup7.getByText;
94
+ getByText = _setup8.getByText;
81
95
 
82
96
  expect(getByText('Invitation sent')).toBeTruthy();
83
97
  });
84
98
  it('should show "Invitation seen" when status is seen', function () {
85
- var _setup8 = setup({
99
+ var _setup9 = setup({
86
100
  status: 'seen',
87
101
  isMe: false
88
102
  }),
89
- getByText = _setup8.getByText;
103
+ getByText = _setup9.getByText;
90
104
 
91
105
  expect(getByText('Invitation seen')).toBeTruthy();
92
106
  });
93
107
  it('should fallback to "Invitation sent" for unknown status', function () {
94
- var _setup9 = setup({
108
+ var _setup10 = setup({
95
109
  status: 'unknown-status',
96
110
  isMe: false
97
111
  }),
98
- getByText = _setup9.getByText;
112
+ getByText = _setup10.getByText;
99
113
 
100
114
  expect(getByText('Invitation sent')).toBeTruthy();
101
115
  });
@@ -1,22 +1,27 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import PropTypes from 'prop-types';
2
3
  import React from 'react';
3
4
  import MemberRecipient from './MemberRecipient';
4
5
  import OwnerRecipientDefault from './OwnerRecipientDefault';
5
6
 
6
7
  var OwnerRecipient = function OwnerRecipient(_ref) {
7
- var recipients = _ref.recipients;
8
+ var recipients = _ref.recipients,
9
+ isOrgSharedDrive = _ref.isOrgSharedDrive;
8
10
  var ownerRecipient = recipients.find(function (recipient) {
9
11
  return recipient.status === 'owner';
10
12
  });
11
13
 
12
14
  if (ownerRecipient) {
13
- return /*#__PURE__*/React.createElement(MemberRecipient, ownerRecipient);
15
+ return /*#__PURE__*/React.createElement(MemberRecipient, _extends({}, ownerRecipient, {
16
+ isOrgSharedDrive: isOrgSharedDrive
17
+ }));
14
18
  }
15
19
 
16
20
  return /*#__PURE__*/React.createElement(OwnerRecipientDefault, null);
17
21
  };
18
22
 
19
23
  OwnerRecipient.propTypes = {
20
- recipients: PropTypes.array.isRequired
24
+ recipients: PropTypes.array.isRequired,
25
+ isOrgSharedDrive: PropTypes.bool
21
26
  };
22
27
  export default OwnerRecipient;
@@ -36,7 +36,10 @@ jest.mock('../hooks/useSharingContext', function () {
36
36
  getSharingLink: jest.fn(function () {
37
37
  return null;
38
38
  }),
39
- updateSharingMemberType: jest.fn()
39
+ updateSharingMemberType: jest.fn(),
40
+ isOrgSharedDrive: jest.fn(function () {
41
+ return false;
42
+ })
40
43
  };
41
44
  }
42
45
  };
@@ -20,7 +20,10 @@ jest.mock('../hooks/useSharingContext', function () {
20
20
  return mockSharingLink;
21
21
  },
22
22
  revokeSharingLink: jest.fn(),
23
- updateDocumentPermissions: jest.fn()
23
+ updateDocumentPermissions: jest.fn(),
24
+ isOrgSharedDrive: jest.fn(function () {
25
+ return false;
26
+ })
24
27
  };
25
28
  }
26
29
  };
@@ -6,6 +6,7 @@ import LinkRecipient from './Recipient/LinkRecipient';
6
6
  import OwnerRecipient from './Recipient/OwnerRecipient';
7
7
  import { RecipientList } from './Recipient/RecipientList';
8
8
  import { usePrevious } from '../helpers/hooks';
9
+ import { useSharingContext } from '../hooks/useSharingContext';
9
10
  /**
10
11
  * Displays a warning if some contacts are waiting for confirmation of their sharing
11
12
  *
@@ -52,6 +53,11 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
52
53
  permissions = _ref2.permissions;
53
54
  var previousLink = usePrevious(link);
54
55
  var linkHasBeenJustCreated = link && previousLink === null;
56
+
57
+ var _useSharingContext = useSharingContext(),
58
+ isOrgSharedDrive = _useSharingContext.isOrgSharedDrive;
59
+
60
+ var isOrgDrive = isOrgSharedDrive(document === null || document === void 0 ? void 0 : document._id);
55
61
  return /*#__PURE__*/React.createElement("div", {
56
62
  className: className
57
63
  }, /*#__PURE__*/React.createElement(RecipientWaitingForConfirmationAlert, {
@@ -65,7 +71,8 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
65
71
  permissions: permissions,
66
72
  fadeIn: linkHasBeenJustCreated
67
73
  }), showOwner && /*#__PURE__*/React.createElement(OwnerRecipient, {
68
- recipients: recipients
74
+ recipients: recipients,
75
+ isOrgSharedDrive: isOrgDrive
69
76
  }), /*#__PURE__*/React.createElement(RecipientList, {
70
77
  recipients: recipients,
71
78
  recipientsToBeConfirmed: recipientsToBeConfirmed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "36.2.1",
3
+ "version": "36.3.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -85,5 +85,5 @@
85
85
  "sideEffects": [
86
86
  "*.css"
87
87
  ],
88
- "gitHead": "f24d4b10dd14b3bdd673ad04aa91d401775a82cf"
88
+ "gitHead": "13ca01d79ed7be07410ccc84ebd9a38b112ee0d9"
89
89
  }
@@ -40,7 +40,8 @@ jest.mock('../../hooks/useSharingContext', () => ({
40
40
  getSharedParentPath: jest.fn().mockReturnValue(null),
41
41
  getSharingById: mockGetSharingById,
42
42
  hasSharedChild: mockHasSharedChild,
43
- hasSharedParent: mockHasSharedParent
43
+ hasSharedParent: mockHasSharedParent,
44
+ isOrgSharedDrive: jest.fn(() => false)
44
45
  })
45
46
  }))
46
47
 
@@ -32,6 +32,7 @@ const MemberRecipient = props => {
32
32
  recipientConfirmationData,
33
33
  verifyRecipient,
34
34
  fadeIn,
35
+ isOrgSharedDrive,
35
36
  ...rest
36
37
  } = props
37
38
 
@@ -68,6 +69,7 @@ const MemberRecipient = props => {
68
69
  instance={instance}
69
70
  email={rest.email}
70
71
  name={rest.name || rest.public_name}
72
+ isOrgSharedDrive={isOrgSharedDrive}
71
73
  />
72
74
  }
73
75
  />
@@ -82,7 +84,8 @@ MemberRecipient.propTypes = {
82
84
  isOwner: PropTypes.bool,
83
85
  status: PropTypes.string,
84
86
  recipientConfirmationData: PropTypes.object,
85
- verifyRecipient: PropTypes.func
87
+ verifyRecipient: PropTypes.func,
88
+ isOrgSharedDrive: PropTypes.bool
86
89
  }
87
90
 
88
91
  export default MemberRecipient
@@ -10,6 +10,7 @@ const MemberRecipientStatus = ({
10
10
  instance,
11
11
  email,
12
12
  name,
13
+ isOrgSharedDrive,
13
14
  typographyProps
14
15
  }) => {
15
16
  const { t } = useI18n()
@@ -22,7 +23,13 @@ const MemberRecipientStatus = ({
22
23
  // (getDisplayName falls back to email when the recipient has no name).
23
24
  // Keep the instance visible when there is no email at all, so the user
24
25
  // can still tell the recipient lives on a different Cozy instance.
25
- text = isMe || name || !email ? email || instance : ''
26
+ // For org shared drive owners, hide the email and instance entirely.
27
+ text =
28
+ status === 'owner' && isOrgSharedDrive
29
+ ? ''
30
+ : isMe || name || !email
31
+ ? email || instance
32
+ : ''
26
33
  } else if (isSendingEmail) {
27
34
  text = t('Share.status.mail-not-sent')
28
35
  } else {
@@ -45,6 +52,7 @@ MemberRecipientStatus.propTypes = {
45
52
  instance: PropTypes.string,
46
53
  email: PropTypes.string,
47
54
  name: PropTypes.string,
55
+ isOrgSharedDrive: PropTypes.bool,
48
56
  typographyProps: PropTypes.object
49
57
  }
50
58
 
@@ -63,6 +63,19 @@ describe('MemberRecipientStatus component', () => {
63
63
  expect(getByText('owner@example.com')).toBeTruthy()
64
64
  })
65
65
 
66
+ it('should hide email and instance when status is owner and isOrgSharedDrive is true', () => {
67
+ const { queryByText } = setup({
68
+ status: 'owner',
69
+ isMe: false,
70
+ email: 'org@example.com',
71
+ instance: 'foo.mycozy.cloud',
72
+ name: 'Org Owner',
73
+ isOrgSharedDrive: true
74
+ })
75
+ expect(queryByText('org@example.com')).toBe(null)
76
+ expect(queryByText('foo.mycozy.cloud')).toBe(null)
77
+ })
78
+
66
79
  it('should show "Sending invitation mail..." when status is mail-not-sent and not isMe', () => {
67
80
  const { getByText } = setup({
68
81
  status: 'mail-not-sent',
@@ -4,20 +4,26 @@ import React from 'react'
4
4
  import MemberRecipient from './MemberRecipient'
5
5
  import OwnerRecipientDefault from './OwnerRecipientDefault'
6
6
 
7
- const OwnerRecipient = ({ recipients }) => {
7
+ const OwnerRecipient = ({ recipients, isOrgSharedDrive }) => {
8
8
  const ownerRecipient = recipients.find(
9
9
  recipient => recipient.status === 'owner'
10
10
  )
11
11
 
12
12
  if (ownerRecipient) {
13
- return <MemberRecipient {...ownerRecipient} />
13
+ return (
14
+ <MemberRecipient
15
+ {...ownerRecipient}
16
+ isOrgSharedDrive={isOrgSharedDrive}
17
+ />
18
+ )
14
19
  }
15
20
 
16
21
  return <OwnerRecipientDefault />
17
22
  }
18
23
 
19
24
  OwnerRecipient.propTypes = {
20
- recipients: PropTypes.array.isRequired
25
+ recipients: PropTypes.array.isRequired,
26
+ isOrgSharedDrive: PropTypes.bool
21
27
  }
22
28
 
23
29
  export default OwnerRecipient
@@ -17,7 +17,8 @@ jest.mock('cozy-client', () => ({
17
17
  jest.mock('../hooks/useSharingContext', () => ({
18
18
  useSharingContext: () => ({
19
19
  getSharingLink: jest.fn(() => null),
20
- updateSharingMemberType: jest.fn()
20
+ updateSharingMemberType: jest.fn(),
21
+ isOrgSharedDrive: jest.fn(() => false)
21
22
  })
22
23
  }))
23
24
 
@@ -14,7 +14,8 @@ jest.mock('../hooks/useSharingContext', () => ({
14
14
  getDocumentPermissions: () => [],
15
15
  getSharingLink: () => mockSharingLink,
16
16
  revokeSharingLink: jest.fn(),
17
- updateDocumentPermissions: jest.fn()
17
+ updateDocumentPermissions: jest.fn(),
18
+ isOrgSharedDrive: jest.fn(() => false)
18
19
  })
19
20
  }))
20
21
 
@@ -8,6 +8,7 @@ import LinkRecipient from './Recipient/LinkRecipient'
8
8
  import OwnerRecipient from './Recipient/OwnerRecipient'
9
9
  import { RecipientList } from './Recipient/RecipientList'
10
10
  import { usePrevious } from '../helpers/hooks'
11
+ import { useSharingContext } from '../hooks/useSharingContext'
11
12
 
12
13
  /**
13
14
  * Displays a warning if some contacts are waiting for confirmation of their sharing
@@ -46,6 +47,8 @@ const WhoHasAccess = ({
46
47
  }) => {
47
48
  const previousLink = usePrevious(link)
48
49
  const linkHasBeenJustCreated = link && previousLink === null
50
+ const { isOrgSharedDrive } = useSharingContext()
51
+ const isOrgDrive = isOrgSharedDrive(document?._id)
49
52
 
50
53
  return (
51
54
  <div className={className}>
@@ -65,7 +68,12 @@ const WhoHasAccess = ({
65
68
  />
66
69
  )}
67
70
 
68
- {showOwner && <OwnerRecipient recipients={recipients} />}
71
+ {showOwner && (
72
+ <OwnerRecipient
73
+ recipients={recipients}
74
+ isOrgSharedDrive={isOrgDrive}
75
+ />
76
+ )}
69
77
 
70
78
  <RecipientList
71
79
  recipients={recipients}