cozy-sharing 33.5.0 → 33.6.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 +18 -0
- package/dist/components/FederatedFolder/FederatedFolderModal.js +1 -4
- package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +3 -1
- package/dist/components/Recipient/LinkRecipient.js +40 -17
- package/dist/components/Recipient/LinkRecipientPermissions.js +7 -6
- package/dist/components/Recipient/MemberRecipient.js +4 -5
- package/dist/components/Recipient/MemberRecipientLite.js +2 -0
- package/dist/components/Recipient/MemberRecipientPermissions.js +4 -6
- package/dist/components/Recipient/MemberRecipientStatus.js +19 -16
- package/dist/components/Recipient/MemberRecipientStatus.spec.js +102 -0
- package/dist/components/Recipient/RecipientConfirm.js +1 -4
- package/dist/components/Recipient/RecipientList.js +2 -0
- package/dist/components/ShareByEmail.js +1 -4
- package/dist/components/ShareDialogCozyToCozy.js +1 -4
- package/dist/components/ShareModal/ShareModal.js +1 -5
- package/dist/components/ShareModal/SharingDetailsModal.js +6 -38
- package/dist/components/SharedDrive/EditSharedDriveModal.js +1 -4
- package/dist/components/WhoHasAccess.js +4 -0
- package/dist/state.js +1 -1
- package/dist/styles/share.styl +0 -21
- package/dist/stylesheet.css +0 -22
- package/locales/en.json +1 -2
- package/locales/fr.json +1 -2
- package/locales/ru.json +1 -2
- package/locales/vi.json +1 -2
- package/package.json +2 -2
- package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +2 -0
- package/src/components/Recipient/LinkRecipient.jsx +50 -15
- package/src/components/Recipient/LinkRecipientPermissions.jsx +27 -20
- package/src/components/Recipient/MemberRecipient.jsx +3 -1
- package/src/components/Recipient/MemberRecipientLite.jsx +2 -0
- package/src/components/Recipient/MemberRecipientPermissions.jsx +10 -5
- package/src/components/Recipient/MemberRecipientStatus.jsx +27 -18
- package/src/components/Recipient/MemberRecipientStatus.spec.jsx +97 -0
- package/src/components/Recipient/RecipientList.jsx +2 -0
- package/src/components/ShareModal/ShareModal.jsx +1 -5
- package/src/components/ShareModal/SharingDetailsModal.jsx +3 -47
- package/src/components/WhoHasAccess.jsx +3 -0
- package/src/state.js +1 -1
- package/src/styles/share.styl +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
# [33.6.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.5.1...cozy-sharing@33.6.0) (2026-06-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Add prop to enable a readonly list in WhoHasAccess ([9643520](https://github.com/cozy/cozy-libs/commit/9643520bfbd9d1da425176efec5e361bf5ef1498))
|
|
11
|
+
- Display read only modal (details modal) for B2B shared drive ([9960588](https://github.com/cozy/cozy-libs/commit/9960588289d67555f0a3cf3e0b24fd7c8fe222fc))
|
|
12
|
+
- Enable readonly display of link recipient ([c5146b0](https://github.com/cozy/cozy-libs/commit/c5146b094b17c7956419dd50b47b113b929daa29))
|
|
13
|
+
- Remove unwanted details from sharing details modal ([b067718](https://github.com/cozy/cozy-libs/commit/b0677189eeebe258177187ea98ce2f48b6af8777))
|
|
14
|
+
- Show "Owner" if owner or type otherwise when no menu in member ([b4ef094](https://github.com/cozy/cozy-libs/commit/b4ef0942ecba54a21f4ed0ed16ccc480a1e1525d))
|
|
15
|
+
- Show type instead of status when no menu in member ([ba87489](https://github.com/cozy/cozy-libs/commit/ba874890418899aeecdba41b792724dbae0ce7c9))
|
|
16
|
+
|
|
17
|
+
## [33.5.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.5.0...cozy-sharing@33.5.1) (2026-06-17)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- **cozy-sharing:** Avoid rendering email twice in recipient row ([800f091](https://github.com/cozy/cozy-libs/commit/800f0915853f167b47087b77ef1a4620a4615fa3))
|
|
22
|
+
- **cozy-sharing:** Prioritize email over instance URL ([4814ab3](https://github.com/cozy/cozy-libs/commit/4814ab34ec13cd8f53641dd333107f2648fb8e76))
|
|
23
|
+
|
|
6
24
|
# [33.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.4.3...cozy-sharing@33.5.0) (2026-06-17)
|
|
7
25
|
|
|
8
26
|
### Features
|
|
@@ -31,10 +31,7 @@ var styles = {
|
|
|
31
31
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
32
32
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
33
33
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
34
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
35
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
36
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
37
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
34
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
38
35
|
};
|
|
39
36
|
import AntivirusAlert from '../AntivirusAlert';
|
|
40
37
|
import { default as DumbShareByEmail } from '../ShareByEmail';
|
|
@@ -33,7 +33,9 @@ var GroupRecipientDetailWithAccess = function GroupRecipientDetailWithAccess(_re
|
|
|
33
33
|
secondary: /*#__PURE__*/React.createElement(MemberRecipientStatus, {
|
|
34
34
|
status: recipient.status,
|
|
35
35
|
isMe: isMe,
|
|
36
|
-
instance: recipient.instance
|
|
36
|
+
instance: recipient.instance,
|
|
37
|
+
email: recipient.email,
|
|
38
|
+
name: recipient.name || recipient.public_name
|
|
37
39
|
})
|
|
38
40
|
}));
|
|
39
41
|
})));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import React, { useState } from 'react';
|
|
@@ -21,6 +20,37 @@ import { FADE_IN_DURATION } from '../../helpers/recipients';
|
|
|
21
20
|
import { useSharingContext } from '../../hooks/useSharingContext';
|
|
22
21
|
import { ShareRestrictionModal } from '../ShareRestrictionModal/ShareRestrictionModal';
|
|
23
22
|
|
|
23
|
+
var LinkRecipientTextReadOnly = function LinkRecipientTextReadOnly(_ref) {
|
|
24
|
+
var textPrimary = _ref.textPrimary,
|
|
25
|
+
textSecondary = _ref.textSecondary;
|
|
26
|
+
return /*#__PURE__*/React.createElement(ListItemText, {
|
|
27
|
+
primary: /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "u-flex u-flex-items-center"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Typography, null, textPrimary)),
|
|
30
|
+
secondary: textSecondary
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var LinkRecipientText = function LinkRecipientText(_ref2) {
|
|
35
|
+
var onClick = _ref2.onClick,
|
|
36
|
+
textPrimary = _ref2.textPrimary,
|
|
37
|
+
textSecondary = _ref2.textSecondary;
|
|
38
|
+
return /*#__PURE__*/React.createElement(ListItemText, {
|
|
39
|
+
onClick: onClick,
|
|
40
|
+
primary: /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "u-flex u-flex-items-center"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
43
|
+
className: "u-c-pointer "
|
|
44
|
+
}, textPrimary), /*#__PURE__*/React.createElement(IconButton, {
|
|
45
|
+
size: "small",
|
|
46
|
+
className: "u-ml-half"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
48
|
+
icon: Gear
|
|
49
|
+
}))),
|
|
50
|
+
secondary: textSecondary
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
24
54
|
var LinkRecipient = function LinkRecipient(props) {
|
|
25
55
|
var _useI18n = useI18n(),
|
|
26
56
|
t = _useI18n.t,
|
|
@@ -36,7 +66,8 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
36
66
|
var recipientConfirmationData = props.recipientConfirmationData,
|
|
37
67
|
verifyRecipient = props.verifyRecipient,
|
|
38
68
|
fadeIn = props.fadeIn,
|
|
39
|
-
document = props.document
|
|
69
|
+
document = props.document,
|
|
70
|
+
isReadOnly = props.isReadOnly;
|
|
40
71
|
|
|
41
72
|
var _useState = useState(false),
|
|
42
73
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -54,9 +85,7 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
54
85
|
var RightPart = recipientConfirmationData ? /*#__PURE__*/React.createElement(RecipientConfirm, {
|
|
55
86
|
recipientConfirmationData: recipientConfirmationData,
|
|
56
87
|
verifyRecipient: verifyRecipient
|
|
57
|
-
}) : /*#__PURE__*/React.createElement(LinkRecipientPermissions,
|
|
58
|
-
className: "u-flex-shrink-0"
|
|
59
|
-
}));
|
|
88
|
+
}) : /*#__PURE__*/React.createElement(LinkRecipientPermissions, props);
|
|
60
89
|
return /*#__PURE__*/React.createElement(Fade, {
|
|
61
90
|
in: true,
|
|
62
91
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
@@ -70,21 +99,15 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
70
99
|
innerBorder: true
|
|
71
100
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
72
101
|
icon: LinkIcon
|
|
73
|
-
}))), /*#__PURE__*/React.createElement(
|
|
102
|
+
}))), isReadOnly ? /*#__PURE__*/React.createElement(LinkRecipientTextReadOnly, {
|
|
103
|
+
textPrimary: textPrimary,
|
|
104
|
+
textSecondary: textSecondary
|
|
105
|
+
}) : /*#__PURE__*/React.createElement(LinkRecipientText, {
|
|
74
106
|
onClick: function onClick() {
|
|
75
107
|
return setOpenShareRestrictionModal(true);
|
|
76
108
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
80
|
-
className: "u-c-pointer "
|
|
81
|
-
}, textPrimary), /*#__PURE__*/React.createElement(IconButton, {
|
|
82
|
-
size: "small",
|
|
83
|
-
className: "u-ml-half"
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
85
|
-
icon: Gear
|
|
86
|
-
}))),
|
|
87
|
-
secondary: textSecondary
|
|
109
|
+
textPrimary: textPrimary,
|
|
110
|
+
textSecondary: textSecondary
|
|
88
111
|
}), RightPart, openShareRestrictionModal && /*#__PURE__*/React.createElement(ShareRestrictionModal, {
|
|
89
112
|
file: document,
|
|
90
113
|
onClose: function onClose() {
|
|
@@ -4,6 +4,7 @@ import React, { useState, useRef } from 'react';
|
|
|
4
4
|
import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu';
|
|
5
5
|
import { makeActions, divider } from 'cozy-ui/transpiled/react/ActionsMenu/Actions';
|
|
6
6
|
import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton';
|
|
7
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
7
8
|
import { useI18n } from 'twake-i18n';
|
|
8
9
|
import { revokeLink } from './actions/revokeLink';
|
|
9
10
|
import { setReadOnlySharedPermission } from './actions/setReadOnlySharedPermission';
|
|
@@ -14,8 +15,8 @@ import { useSharingContext } from '../../hooks/useSharingContext';
|
|
|
14
15
|
import { WRITE_PERMS, READ_ONLY_PERMS } from '../ShareRestrictionModal/helpers';
|
|
15
16
|
|
|
16
17
|
var LinkRecipientPermissions = function LinkRecipientPermissions(_ref) {
|
|
17
|
-
var
|
|
18
|
-
|
|
18
|
+
var document = _ref.document,
|
|
19
|
+
isReadOnly = _ref.isReadOnly;
|
|
19
20
|
|
|
20
21
|
var _useI18n = useI18n(),
|
|
21
22
|
t = _useI18n.t;
|
|
@@ -72,9 +73,10 @@ var LinkRecipientPermissions = function LinkRecipientPermissions(_ref) {
|
|
|
72
73
|
setType: handleSetType,
|
|
73
74
|
handleRevocation: handleRevocation
|
|
74
75
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
var shouldShowMenu = !isReadOnly;
|
|
77
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !shouldShowMenu && /*#__PURE__*/React.createElement(Typography, {
|
|
78
|
+
variant: "body2"
|
|
79
|
+
}, t("Share.type.".concat(type))), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
|
|
78
80
|
ref: buttonRef,
|
|
79
81
|
textVariant: "body2",
|
|
80
82
|
onClick: toggleMenu
|
|
@@ -88,7 +90,6 @@ var LinkRecipientPermissions = function LinkRecipientPermissions(_ref) {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
LinkRecipientPermissions.propTypes = {
|
|
91
|
-
className: PropTypes.string,
|
|
92
93
|
document: PropTypes.object.isRequired
|
|
93
94
|
};
|
|
94
95
|
export default LinkRecipientPermissions;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
2
|
var _excluded = ["instance", "isOwner", "status", "recipientConfirmationData", "verifyRecipient", "fadeIn"];
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
@@ -41,9 +40,7 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
41
40
|
var RightPart = recipientConfirmationData ? /*#__PURE__*/React.createElement(RecipientConfirm, {
|
|
42
41
|
recipientConfirmationData: recipientConfirmationData,
|
|
43
42
|
verifyRecipient: verifyRecipient
|
|
44
|
-
}) : /*#__PURE__*/React.createElement(MemberRecipientPermissions,
|
|
45
|
-
className: "u-flex-shrink-0"
|
|
46
|
-
}));
|
|
43
|
+
}) : /*#__PURE__*/React.createElement(MemberRecipientPermissions, props);
|
|
47
44
|
return /*#__PURE__*/React.createElement(Fade, {
|
|
48
45
|
in: true,
|
|
49
46
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
@@ -60,7 +57,9 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
60
57
|
secondary: /*#__PURE__*/React.createElement(MemberRecipientStatus, {
|
|
61
58
|
status: status,
|
|
62
59
|
isMe: isMe,
|
|
63
|
-
instance: instance
|
|
60
|
+
instance: instance,
|
|
61
|
+
email: rest.email,
|
|
62
|
+
name: rest.name || rest.public_name
|
|
64
63
|
})
|
|
65
64
|
}), RightPart));
|
|
66
65
|
};
|
|
@@ -21,11 +21,11 @@ var log = minilog('MemberRecipientPermissions');
|
|
|
21
21
|
|
|
22
22
|
var MemberRecipientPermissions = function MemberRecipientPermissions(_ref) {
|
|
23
23
|
var isOwner = _ref.isOwner,
|
|
24
|
+
isReadOnly = _ref.isReadOnly,
|
|
24
25
|
status = _ref.status,
|
|
25
26
|
instance = _ref.instance,
|
|
26
27
|
type = _ref.type,
|
|
27
28
|
document = _ref.document,
|
|
28
|
-
className = _ref.className,
|
|
29
29
|
onRevoke = _ref.onRevoke,
|
|
30
30
|
onRevokeSelf = _ref.onRevokeSelf,
|
|
31
31
|
sharingId = _ref.sharingId,
|
|
@@ -55,7 +55,7 @@ var MemberRecipientPermissions = function MemberRecipientPermissions(_ref) {
|
|
|
55
55
|
|
|
56
56
|
var instanceMatchesClient = instance !== undefined && instance === client.options.uri;
|
|
57
57
|
var contactIsOwner = status === 'owner';
|
|
58
|
-
var shouldShowMenu = !revoking && !contactIsOwner && (instanceMatchesClient && !isOwner || isOwner);
|
|
58
|
+
var shouldShowMenu = !isReadOnly && !revoking && !contactIsOwner && (instanceMatchesClient && !isOwner || isOwner);
|
|
59
59
|
var toggleMenu = useCallback(function () {
|
|
60
60
|
setMenuDisplayed(function (displayed) {
|
|
61
61
|
return !displayed;
|
|
@@ -147,11 +147,9 @@ var MemberRecipientPermissions = function MemberRecipientPermissions(_ref) {
|
|
|
147
147
|
type: type !== null && type !== void 0 ? type : 'one-way',
|
|
148
148
|
setType: setType
|
|
149
149
|
});
|
|
150
|
-
return /*#__PURE__*/React.createElement(
|
|
151
|
-
className: className
|
|
152
|
-
}, revoking && /*#__PURE__*/React.createElement(Spinner, null), !shouldShowMenu && !revoking && /*#__PURE__*/React.createElement(Typography, {
|
|
150
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, revoking && /*#__PURE__*/React.createElement(Spinner, null), !shouldShowMenu && /*#__PURE__*/React.createElement(Typography, {
|
|
153
151
|
variant: "body2"
|
|
154
|
-
}, t("Share.status.".concat(status))), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
|
|
152
|
+
}, contactIsOwner ? t("Share.status.".concat(status)) : t("Share.type.".concat(type))), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
|
|
155
153
|
ref: buttonRef,
|
|
156
154
|
"aria-controls": "simple-menu",
|
|
157
155
|
"aria-haspopup": "true",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
4
|
-
import EyeIcon from 'cozy-ui/transpiled/react/Icons/Eye';
|
|
5
|
-
import PaperplaneIcon from 'cozy-ui/transpiled/react/Icons/Paperplane';
|
|
6
|
-
import ToTheCloudIcon from 'cozy-ui/transpiled/react/Icons/ToTheCloud';
|
|
7
4
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
8
5
|
import { useI18n } from 'twake-i18n';
|
|
9
6
|
|
|
@@ -11,6 +8,8 @@ var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
|
|
|
11
8
|
var status = _ref.status,
|
|
12
9
|
isMe = _ref.isMe,
|
|
13
10
|
instance = _ref.instance,
|
|
11
|
+
email = _ref.email,
|
|
12
|
+
name = _ref.name,
|
|
14
13
|
typographyProps = _ref.typographyProps;
|
|
15
14
|
|
|
16
15
|
var _useI18n = useI18n(),
|
|
@@ -18,29 +17,33 @@ var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
|
|
|
18
17
|
|
|
19
18
|
var isSendingEmail = !isMe && status === 'mail-not-sent';
|
|
20
19
|
var isReady = isMe || status === 'ready' || status === 'owner';
|
|
21
|
-
var text
|
|
20
|
+
var text;
|
|
22
21
|
|
|
23
22
|
if (isReady) {
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// Hide the email when the parent already uses it as the primary text
|
|
24
|
+
// (getDisplayName falls back to email when the recipient has no name).
|
|
25
|
+
// Keep the instance visible when there is no email at all, so the user
|
|
26
|
+
// can still tell the recipient lives on a different Cozy instance.
|
|
27
|
+
text = isMe || name || !email ? email || instance : '';
|
|
26
28
|
} else if (isSendingEmail) {
|
|
27
29
|
text = t('Share.status.mail-not-sent');
|
|
28
|
-
icon = PaperplaneIcon;
|
|
29
30
|
} else {
|
|
30
31
|
var supportedStatus = ['pending', 'seen'];
|
|
31
32
|
text = supportedStatus.includes(status) ? t("Share.status.".concat(status)) : t('Share.status.pending');
|
|
32
|
-
icon = status === 'seen' ? EyeIcon : PaperplaneIcon;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
-
className: "u-flex u-flex-items-center"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
38
|
-
icon: icon,
|
|
39
|
-
size: 10
|
|
40
|
-
}), "\xA0", /*#__PURE__*/React.createElement(Typography, _extends({
|
|
35
|
+
return /*#__PURE__*/React.createElement(Typography, _extends({
|
|
41
36
|
variant: "caption",
|
|
42
37
|
color: "textSecondary"
|
|
43
|
-
}, typographyProps), text)
|
|
38
|
+
}, typographyProps), text);
|
|
44
39
|
};
|
|
45
40
|
|
|
41
|
+
MemberRecipientStatus.propTypes = {
|
|
42
|
+
status: PropTypes.string,
|
|
43
|
+
isMe: PropTypes.bool,
|
|
44
|
+
instance: PropTypes.string,
|
|
45
|
+
email: PropTypes.string,
|
|
46
|
+
name: PropTypes.string,
|
|
47
|
+
typographyProps: PropTypes.object
|
|
48
|
+
};
|
|
46
49
|
export default MemberRecipientStatus;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import MemberRecipientStatus from './MemberRecipientStatus';
|
|
4
|
+
import AppLike from '../../../test/AppLike';
|
|
5
|
+
describe('MemberRecipientStatus component', function () {
|
|
6
|
+
var setup = function setup(props) {
|
|
7
|
+
return render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(MemberRecipientStatus, props)));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
it('should show email when status is ready and recipient has a name', function () {
|
|
11
|
+
var _setup = setup({
|
|
12
|
+
status: 'ready',
|
|
13
|
+
isMe: false,
|
|
14
|
+
email: 'other@example.com',
|
|
15
|
+
instance: 'foo.mycozy.cloud',
|
|
16
|
+
name: 'Other Person'
|
|
17
|
+
}),
|
|
18
|
+
getByText = _setup.getByText;
|
|
19
|
+
|
|
20
|
+
expect(getByText('other@example.com')).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
it('should render nothing when recipient has no name and status is ready', function () {
|
|
23
|
+
var _setup2 = setup({
|
|
24
|
+
status: 'ready',
|
|
25
|
+
isMe: false,
|
|
26
|
+
email: 'other@example.com',
|
|
27
|
+
instance: 'foo.mycozy.cloud'
|
|
28
|
+
}),
|
|
29
|
+
queryByText = _setup2.queryByText;
|
|
30
|
+
|
|
31
|
+
expect(queryByText('other@example.com')).toBe(null);
|
|
32
|
+
expect(queryByText('foo.mycozy.cloud')).toBe(null);
|
|
33
|
+
});
|
|
34
|
+
it('should show email when isMe is true regardless of status', function () {
|
|
35
|
+
var _setup3 = setup({
|
|
36
|
+
status: 'pending',
|
|
37
|
+
isMe: true,
|
|
38
|
+
email: 'me@example.com'
|
|
39
|
+
}),
|
|
40
|
+
getByText = _setup3.getByText;
|
|
41
|
+
|
|
42
|
+
expect(getByText('me@example.com')).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
it('should fallback to instance when email is missing and status is ready', function () {
|
|
45
|
+
var _setup4 = setup({
|
|
46
|
+
status: 'ready',
|
|
47
|
+
isMe: false,
|
|
48
|
+
instance: 'foo.mycozy.cloud'
|
|
49
|
+
}),
|
|
50
|
+
getByText = _setup4.getByText;
|
|
51
|
+
|
|
52
|
+
expect(getByText('foo.mycozy.cloud')).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('should show email when status is owner, not isMe, and recipient has a name', function () {
|
|
55
|
+
var _setup5 = setup({
|
|
56
|
+
status: 'owner',
|
|
57
|
+
isMe: false,
|
|
58
|
+
email: 'owner@example.com',
|
|
59
|
+
instance: 'foo.mycozy.cloud',
|
|
60
|
+
name: 'Owner Person'
|
|
61
|
+
}),
|
|
62
|
+
getByText = _setup5.getByText;
|
|
63
|
+
|
|
64
|
+
expect(getByText('owner@example.com')).toBeTruthy();
|
|
65
|
+
});
|
|
66
|
+
it('should show "Sending invitation mail..." when status is mail-not-sent and not isMe', function () {
|
|
67
|
+
var _setup6 = setup({
|
|
68
|
+
status: 'mail-not-sent',
|
|
69
|
+
isMe: false
|
|
70
|
+
}),
|
|
71
|
+
getByText = _setup6.getByText;
|
|
72
|
+
|
|
73
|
+
expect(getByText('Sending invitation mail...')).toBeTruthy();
|
|
74
|
+
});
|
|
75
|
+
it('should show "Invitation sent" when status is pending', function () {
|
|
76
|
+
var _setup7 = setup({
|
|
77
|
+
status: 'pending',
|
|
78
|
+
isMe: false
|
|
79
|
+
}),
|
|
80
|
+
getByText = _setup7.getByText;
|
|
81
|
+
|
|
82
|
+
expect(getByText('Invitation sent')).toBeTruthy();
|
|
83
|
+
});
|
|
84
|
+
it('should show "Invitation seen" when status is seen', function () {
|
|
85
|
+
var _setup8 = setup({
|
|
86
|
+
status: 'seen',
|
|
87
|
+
isMe: false
|
|
88
|
+
}),
|
|
89
|
+
getByText = _setup8.getByText;
|
|
90
|
+
|
|
91
|
+
expect(getByText('Invitation seen')).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
it('should fallback to "Invitation sent" for unknown status', function () {
|
|
94
|
+
var _setup9 = setup({
|
|
95
|
+
status: 'unknown-status',
|
|
96
|
+
isMe: false
|
|
97
|
+
}),
|
|
98
|
+
getByText = _setup9.getByText;
|
|
99
|
+
|
|
100
|
+
expect(getByText('Invitation sent')).toBeTruthy();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -18,10 +18,7 @@ var modalStyles = {
|
|
|
18
18
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
19
19
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
20
20
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
21
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
22
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
23
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
24
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
21
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
25
22
|
};
|
|
26
23
|
/**
|
|
27
24
|
* Displays the confirmation interface that allows to confirm or reject a recipient
|
|
@@ -10,6 +10,7 @@ var RecipientList = function RecipientList(_ref) {
|
|
|
10
10
|
recipientsToBeConfirmed = _ref.recipientsToBeConfirmed,
|
|
11
11
|
isOwner = _ref.isOwner,
|
|
12
12
|
isSharedDrive = _ref.isSharedDrive,
|
|
13
|
+
isReadOnly = _ref.isReadOnly,
|
|
13
14
|
document = _ref.document,
|
|
14
15
|
documentType = _ref.documentType,
|
|
15
16
|
onRevoke = _ref.onRevoke,
|
|
@@ -39,6 +40,7 @@ var RecipientList = function RecipientList(_ref) {
|
|
|
39
40
|
key: recipient.index,
|
|
40
41
|
isOwner: isOwner,
|
|
41
42
|
isSharedDrive: isSharedDrive,
|
|
43
|
+
isReadOnly: isReadOnly,
|
|
42
44
|
document: document,
|
|
43
45
|
documentType: documentType,
|
|
44
46
|
onRevoke: onRevoke,
|
|
@@ -23,10 +23,7 @@ var styles = {
|
|
|
23
23
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
24
24
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
25
25
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
26
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
27
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
28
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
29
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
26
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
30
27
|
};
|
|
31
28
|
export var ShareByEmail = function ShareByEmail(_ref) {
|
|
32
29
|
var document = _ref.document,
|
|
@@ -41,10 +41,7 @@ var styles = {
|
|
|
41
41
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
42
42
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
43
43
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
44
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
45
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
46
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
47
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
44
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
var SharingContent = function SharingContent(_ref) {
|
|
@@ -29,8 +29,6 @@ export var ShareModal = withLocales(function (props) {
|
|
|
29
29
|
isOwner = _useSharingContext.isOwner,
|
|
30
30
|
canReshare = _useSharingContext.canReshare,
|
|
31
31
|
documentType = _useSharingContext.documentType,
|
|
32
|
-
getOwner = _useSharingContext.getOwner,
|
|
33
|
-
getSharingType = _useSharingContext.getSharingType,
|
|
34
32
|
getRecipients = _useSharingContext.getRecipients,
|
|
35
33
|
revokeSelf = _useSharingContext.revokeSelf,
|
|
36
34
|
allLoaded = _useSharingContext.allLoaded;
|
|
@@ -75,11 +73,9 @@ export var ShareModal = withLocales(function (props) {
|
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
return /*#__PURE__*/React.createElement(SharingDetailsModal, _extends({
|
|
76
|
+
recipients: getRecipients(document.id),
|
|
78
77
|
document: document,
|
|
79
78
|
documentType: documentType,
|
|
80
|
-
owner: getOwner(document.id),
|
|
81
|
-
sharingType: getSharingType(document.id),
|
|
82
|
-
recipients: getRecipients(document.id),
|
|
83
79
|
onRevoke: revokeSelf,
|
|
84
80
|
onRevokeSelf: handleRevokeSelf
|
|
85
81
|
}, rest));
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import cx from 'classnames';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
5
|
-
import Divider from 'cozy-ui/transpiled/react/Divider';
|
|
6
|
-
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
7
4
|
import { useI18n } from 'twake-i18n';
|
|
8
|
-
import { getDisplayName } from '../../models';
|
|
9
5
|
var styles = {
|
|
10
6
|
"share-modal-content": "share__share-modal-content___1iqEq",
|
|
11
7
|
"coz-form": "share__coz-form___1ICST",
|
|
@@ -22,17 +18,11 @@ var styles = {
|
|
|
22
18
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
23
19
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
24
20
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
25
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
26
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
27
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
28
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
21
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
29
22
|
};
|
|
30
|
-
import OwnerIdentity from '../Identity/OwnerIdentity';
|
|
31
23
|
import WhoHasAccess from '../WhoHasAccess';
|
|
32
24
|
export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
33
25
|
var onClose = _ref.onClose,
|
|
34
|
-
sharingType = _ref.sharingType,
|
|
35
|
-
owner = _ref.owner,
|
|
36
26
|
recipients = _ref.recipients,
|
|
37
27
|
document = _ref.document,
|
|
38
28
|
_ref$documentType = _ref.documentType,
|
|
@@ -41,11 +31,7 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
|
41
31
|
onRevokeSelf = _ref.onRevokeSelf;
|
|
42
32
|
|
|
43
33
|
var _useI18n = useI18n(),
|
|
44
|
-
t = _useI18n.t
|
|
45
|
-
f = _useI18n.f;
|
|
46
|
-
|
|
47
|
-
var _useBreakpoints = useBreakpoints(),
|
|
48
|
-
isMobile = _useBreakpoints.isMobile;
|
|
34
|
+
t = _useI18n.t;
|
|
49
35
|
|
|
50
36
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
51
37
|
disableGutters: true,
|
|
@@ -55,32 +41,14 @@ export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
|
55
41
|
title: t("".concat(documentType, ".share.details.title")),
|
|
56
42
|
content: /*#__PURE__*/React.createElement("div", {
|
|
57
43
|
className: styles['share-modal-content']
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
}, owner ? /*#__PURE__*/React.createElement(OwnerIdentity, {
|
|
61
|
-
name: t("".concat(documentType, ".share.sharedBy"), {
|
|
62
|
-
name: getDisplayName(owner)
|
|
63
|
-
}),
|
|
64
|
-
url: owner.instance
|
|
65
|
-
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
66
|
-
className: styles['share-details-created']
|
|
67
|
-
}, t("".concat(documentType, ".share.details.createdAt"), {
|
|
68
|
-
date: f(document.created_at || null, 'do LLLL yyyy')
|
|
69
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
70
|
-
className: styles['share-details-perm']
|
|
71
|
-
}, t("".concat(documentType, ".share.details.").concat(sharingType === 'one-way' ? 'ro' : 'rw'))), /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: styles['share-details-perm-desc']
|
|
73
|
-
}, t("".concat(documentType, ".share.details.desc.").concat(sharingType === 'one-way' ? 'ro' : 'rw')))), /*#__PURE__*/React.createElement(Divider, {
|
|
74
|
-
className: "u-mv-1"
|
|
75
|
-
}), /*#__PURE__*/React.createElement(WhoHasAccess, {
|
|
76
|
-
title: t('Share.recipients.accessCount', {
|
|
77
|
-
count: recipients.length
|
|
78
|
-
}),
|
|
44
|
+
}, /*#__PURE__*/React.createElement(WhoHasAccess, {
|
|
45
|
+
isReadOnly: true,
|
|
79
46
|
recipients: recipients,
|
|
80
47
|
document: document,
|
|
81
48
|
documentType: documentType,
|
|
82
49
|
onRevoke: onRevoke,
|
|
83
|
-
onRevokeSelf: onRevokeSelf
|
|
50
|
+
onRevokeSelf: onRevokeSelf,
|
|
51
|
+
link: "ok"
|
|
84
52
|
}))
|
|
85
53
|
});
|
|
86
54
|
};
|
|
@@ -37,10 +37,7 @@ var styles = {
|
|
|
37
37
|
"share-dialog-scrollable-body": "share__share-dialog-scrollable-body___2O5UT",
|
|
38
38
|
"share-dialog-members": "share__share-dialog-members___CNHKJ",
|
|
39
39
|
"share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
|
|
40
|
-
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
41
|
-
"share-details-created": "share__share-details-created___z3nvO",
|
|
42
|
-
"share-details-perm": "share__share-details-perm___3HjxK",
|
|
43
|
-
"share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
|
|
40
|
+
"aligned-dropdown-button": "share__aligned-dropdown-button___3crgG"
|
|
44
41
|
};
|
|
45
42
|
import { default as DumbShareByEmail } from '../ShareByEmail';
|
|
46
43
|
import WhoHasAccess from '../WhoHasAccess';
|
|
@@ -32,6 +32,8 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
|
|
|
32
32
|
isOwner = _ref2$isOwner === void 0 ? false : _ref2$isOwner,
|
|
33
33
|
_ref2$isSharedDrive = _ref2.isSharedDrive,
|
|
34
34
|
isSharedDrive = _ref2$isSharedDrive === void 0 ? false : _ref2$isSharedDrive,
|
|
35
|
+
_ref2$isReadOnly = _ref2.isReadOnly,
|
|
36
|
+
isReadOnly = _ref2$isReadOnly === void 0 ? false : _ref2$isReadOnly,
|
|
35
37
|
_ref2$showOwner = _ref2.showOwner,
|
|
36
38
|
showOwner = _ref2$showOwner === void 0 ? true : _ref2$showOwner,
|
|
37
39
|
recipients = _ref2.recipients,
|
|
@@ -53,6 +55,7 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
|
|
|
53
55
|
}, /*#__PURE__*/React.createElement(RecipientWaitingForConfirmationAlert, {
|
|
54
56
|
recipientsToBeConfirmed: recipientsToBeConfirmed
|
|
55
57
|
}), /*#__PURE__*/React.createElement(List, null, link && /*#__PURE__*/React.createElement(LinkRecipient, {
|
|
58
|
+
isReadOnly: isReadOnly,
|
|
56
59
|
document: document,
|
|
57
60
|
documentType: documentType,
|
|
58
61
|
onRevoke: onRevoke,
|
|
@@ -66,6 +69,7 @@ var WhoHasAccess = function WhoHasAccess(_ref2) {
|
|
|
66
69
|
recipientsToBeConfirmed: recipientsToBeConfirmed,
|
|
67
70
|
isOwner: isOwner,
|
|
68
71
|
isSharedDrive: isSharedDrive,
|
|
72
|
+
isReadOnly: isReadOnly,
|
|
69
73
|
document: document,
|
|
70
74
|
documentType: documentType,
|
|
71
75
|
onRevoke: onRevoke,
|
package/dist/state.js
CHANGED
|
@@ -435,7 +435,7 @@ export var canReshare = function canReshare(state, docId, instanceUri) {
|
|
|
435
435
|
var me = sharing.attributes.members.find(matchingInstanceName(instanceUri));
|
|
436
436
|
|
|
437
437
|
if (sharing.drive) {
|
|
438
|
-
return me && !me.read_only;
|
|
438
|
+
return !sharing.org_drive && me && !me.read_only;
|
|
439
439
|
} else {
|
|
440
440
|
return sharing.attributes.open_sharing === true && me && !me.read_only;
|
|
441
441
|
}
|
package/dist/styles/share.styl
CHANGED
|
@@ -74,24 +74,3 @@
|
|
|
74
74
|
input[type=text]
|
|
75
75
|
width 100%
|
|
76
76
|
|
|
77
|
-
.share-details-created
|
|
78
|
-
.share-details-perm
|
|
79
|
-
font-size 1rem
|
|
80
|
-
margin 0.5rem 0 0.5rem 3.5rem
|
|
81
|
-
padding-left 1.5rem
|
|
82
|
-
background-position 0 center
|
|
83
|
-
background-repeat no-repeat
|
|
84
|
-
|
|
85
|
-
.share-details-created
|
|
86
|
-
background-image embedurl('../assets/icons/icon-calendar-16.svg')
|
|
87
|
-
|
|
88
|
-
.share-details-perm
|
|
89
|
-
background-image embedurl('../assets/icons/icon-pen-16.svg')
|
|
90
|
-
margin-bottom .2rem
|
|
91
|
-
|
|
92
|
-
.share-details-perm-desc
|
|
93
|
-
font-size .875rem
|
|
94
|
-
margin 0 0 0.5rem 3.5rem
|
|
95
|
-
padding-left 1.5rem
|
|
96
|
-
line-height 1.5
|
|
97
|
-
color var(--secondaryTextColor)
|