cozy-sharing 33.5.1 → 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 +11 -0
- package/dist/components/FederatedFolder/FederatedFolderModal.js +1 -4
- package/dist/components/Recipient/LinkRecipient.js +40 -17
- package/dist/components/Recipient/LinkRecipientPermissions.js +7 -6
- package/dist/components/Recipient/MemberRecipient.js +1 -4
- package/dist/components/Recipient/MemberRecipientPermissions.js +4 -6
- 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/LinkRecipient.jsx +50 -15
- package/src/components/Recipient/LinkRecipientPermissions.jsx +27 -20
- package/src/components/Recipient/MemberRecipient.jsx +1 -1
- package/src/components/Recipient/MemberRecipientPermissions.jsx +10 -5
- 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,17 @@
|
|
|
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
|
+
|
|
6
17
|
## [33.5.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.5.0...cozy-sharing@33.5.1) (2026-06-17)
|
|
7
18
|
|
|
8
19
|
### Bug Fixes
|
|
@@ -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';
|
|
@@ -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
|
|
@@ -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",
|
|
@@ -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)
|
package/dist/stylesheet.css
CHANGED
|
@@ -339,28 +339,6 @@
|
|
|
339
339
|
input[type=text] {
|
|
340
340
|
width: 100%;
|
|
341
341
|
}
|
|
342
|
-
.share__share-details-created___z3nvO,
|
|
343
|
-
.share__share-details-perm___3HjxK {
|
|
344
|
-
font-size: 1rem;
|
|
345
|
-
margin: 0.5rem 0 0.5rem 3.5rem;
|
|
346
|
-
padding-left: 1.5rem;
|
|
347
|
-
background-position: 0 center;
|
|
348
|
-
background-repeat: no-repeat;
|
|
349
|
-
}
|
|
350
|
-
.share__share-details-created___z3nvO {
|
|
351
|
-
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iMTZweCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIyNC4wMDAwMDAsIC0xOTIuMDAwMDAwKSI+CiAgICAgICAgPGcgaWQ9InNsaWNlcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzIuMDAwMDAwLCAzMi4wMDAwMDApIj48L2c+CiAgICAgICAgPHBhdGggZD0iTTIzNywxOTMgTDI0MCwxOTMgTDI0MCwxOTUgTDIyNCwxOTUgTDIyNCwxOTMgTDIyNywxOTMgTDIyNywxOTIgTDIyOSwxOTIgTDIyOSwxOTMgTDIzNSwxOTMgTDIzNSwxOTIgTDIzNywxOTIgTDIzNywxOTMgWiBNMjI0LDE5NiBMMjQwLDE5NiBMMjQwLDIwNi45OTc1MjcgQzI0MCwyMDcuNTUxMTc3IDIzOS41NTUzNjksMjA4IDIzOC45OTkxMjgsMjA4IEwyMjUuMDAwODcyLDIwOCBDMjI0LjQ0ODEwNiwyMDggMjI0LDIwNy41NDQyMzkgMjI0LDIwNi45OTc1MjcgTDIyNCwxOTYgWiBNMjI2LDE5OCBMMjI2LDIwNiBMMjM4LDIwNiBMMjM4LDE5OCBMMjI2LDE5OCBaIE0yMzIsMjAxIEwyMzcsMjAxIEwyMzcsMjA1IEwyMzIsMjA1IEwyMzIsMjAxIFoiIGlkPSJjYWxlbmRhciIgZmlsbD0iIzk1OTk5RCI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4=");
|
|
352
|
-
}
|
|
353
|
-
.share__share-details-perm___3HjxK {
|
|
354
|
-
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBmaWxsPSIjOTU5OTlEIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMDEuNSw5OS41IEwxOTIsMTA5LjAyNTM5MSBMMTkyLDExMiBMMTk1LjAzNzcyLDExMiBMMjA0LjUsMTAyLjUgTDIwMS41LDk5LjUgWiBNMjA2LjkxMjE1NCw5Ni45MTIxNTQxIEMyMDYuMTMyMjQzLDk2LjEzMjI0MjkgMjA0Ljg2OTE0NCw5Ni4xMzA4NTU2IDIwNC4wODkyNjQsOTYuOTEwNzM2MSBMMjAzLDk4IEwyMDYuMDMwNzYyLDEwMSBMMjA3LjA5MjI3MSw5OS45MjUyNjYzIEMyMDcuODY5NzM4LDk5LjEzODExMzQgMjA3Ljg2Mzc3Nyw5Ny44NjM3NzcyIDIwNy4wODc4NDYsOTcuMDg3ODQ1OSBMMjA2LjkxMjE1NCw5Ni45MTIxNTQxIFogTTE5OSwxMTAgTDIwNC45OTcwNzEsMTEwIEMyMDUuNTUwOTczLDExMCAyMDYsMTEwLjQ0Mzg2NSAyMDYsMTExIEMyMDYsMTExLjU1MjI4NSAyMDUuNTUzNjg5LDExMiAyMDUuMDAyNDU1LDExMiBMMTk3LDExMiBMMTk5LDExMCBaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTkyIC05NikiLz4KPC9zdmc+Cg==");
|
|
355
|
-
margin-bottom: 0.2rem;
|
|
356
|
-
}
|
|
357
|
-
.share__share-details-perm-desc___3HyHu {
|
|
358
|
-
font-size: 0.875rem;
|
|
359
|
-
margin: 0 0 0.5rem 3.5rem;
|
|
360
|
-
padding-left: 1.5rem;
|
|
361
|
-
line-height: 1.5;
|
|
362
|
-
color: var(--secondaryTextColor);
|
|
363
|
-
}
|
|
364
342
|
/* imported from autosuggest.styl */
|
|
365
343
|
|
|
366
344
|
.autosuggest__container___1Yro7 {
|
package/locales/en.json
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"you": "You",
|
|
24
24
|
"anyoneWithTheLink": "Anyone with the link",
|
|
25
25
|
"linkWithPassword": "Anyone with a password",
|
|
26
|
-
"expires": "Until %{date}"
|
|
27
|
-
"accessCount": "%{count} people have access"
|
|
26
|
+
"expires": "Until %{date}"
|
|
28
27
|
},
|
|
29
28
|
"create-cozy": "Create |||| Create my Twake",
|
|
30
29
|
"members": {
|
package/locales/fr.json
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"you": "Vous",
|
|
24
24
|
"anyoneWithTheLink": "Tous les utilisateurs qui ont le lien",
|
|
25
25
|
"linkWithPassword": "Tous les utilisateurs avec le mot de passe",
|
|
26
|
-
"expires": "Jusqu'au %{date}"
|
|
27
|
-
"accessCount": "%{count} personnes y ont accès"
|
|
26
|
+
"expires": "Jusqu'au %{date}"
|
|
28
27
|
},
|
|
29
28
|
"create-cozy": "Créer |||| Créer mon Twake",
|
|
30
29
|
"members": {
|
package/locales/ru.json
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"you": "Вы",
|
|
24
24
|
"anyoneWithTheLink": "Любой, у кого есть ссылка",
|
|
25
25
|
"linkWithPassword": "Любой с паролем",
|
|
26
|
-
"expires": "До %{date}"
|
|
27
|
-
"accessCount": "%{count} человек имеют доступ"
|
|
26
|
+
"expires": "До %{date}"
|
|
28
27
|
},
|
|
29
28
|
"create-cozy": "Создать |||| Создать мой Twake",
|
|
30
29
|
"members": {
|
package/locales/vi.json
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"you": "Bạn",
|
|
24
24
|
"anyoneWithTheLink": "Bất kỳ ai có liên kết",
|
|
25
25
|
"linkWithPassword": "Bất kỳ ai có mật khẩu",
|
|
26
|
-
"expires": "Cho đến %{date}"
|
|
27
|
-
"accessCount": "%{count} người có quyền truy cập"
|
|
26
|
+
"expires": "Cho đến %{date}"
|
|
28
27
|
},
|
|
29
28
|
"create-cozy": "Tạo |||| Tạo Twake của tôi",
|
|
30
29
|
"members": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.6.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"sideEffects": [
|
|
84
84
|
"*.css"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "fc451fb2e649fffe6bfc8f16ff812ba4c31531cf"
|
|
87
87
|
}
|
|
@@ -24,16 +24,51 @@ import { FADE_IN_DURATION } from '../../helpers/recipients'
|
|
|
24
24
|
import { useSharingContext } from '../../hooks/useSharingContext'
|
|
25
25
|
import { ShareRestrictionModal } from '../ShareRestrictionModal/ShareRestrictionModal'
|
|
26
26
|
|
|
27
|
+
const LinkRecipientTextReadOnly = ({ textPrimary, textSecondary }) => {
|
|
28
|
+
return (
|
|
29
|
+
<ListItemText
|
|
30
|
+
primary={
|
|
31
|
+
<div className="u-flex u-flex-items-center">
|
|
32
|
+
<Typography>{textPrimary}</Typography>
|
|
33
|
+
</div>
|
|
34
|
+
}
|
|
35
|
+
secondary={textSecondary}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const LinkRecipientText = ({ onClick, textPrimary, textSecondary }) => {
|
|
41
|
+
return (
|
|
42
|
+
<ListItemText
|
|
43
|
+
onClick={onClick}
|
|
44
|
+
primary={
|
|
45
|
+
<div className="u-flex u-flex-items-center">
|
|
46
|
+
<Typography className="u-c-pointer ">{textPrimary}</Typography>
|
|
47
|
+
<IconButton size="small" className="u-ml-half">
|
|
48
|
+
<Icon icon={Gear} />
|
|
49
|
+
</IconButton>
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
secondary={textSecondary}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
27
57
|
const LinkRecipient = props => {
|
|
28
58
|
const { t, f, lang } = useI18n()
|
|
29
59
|
const { isMobile } = useBreakpoints()
|
|
30
60
|
const { getDocumentPermissions } = useSharingContext()
|
|
31
61
|
|
|
32
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
recipientConfirmationData,
|
|
64
|
+
verifyRecipient,
|
|
65
|
+
fadeIn,
|
|
66
|
+
document,
|
|
67
|
+
isReadOnly
|
|
68
|
+
} = props
|
|
33
69
|
|
|
34
70
|
const [openShareRestrictionModal, setOpenShareRestrictionModal] =
|
|
35
71
|
useState(false)
|
|
36
|
-
|
|
37
72
|
const permissions = getDocumentPermissions(document?._id)
|
|
38
73
|
const hasPassword = checkIsPermissionHasPassword(permissions)
|
|
39
74
|
const expiresDate = getPermissionExpiresDate(permissions)
|
|
@@ -57,7 +92,7 @@ const LinkRecipient = props => {
|
|
|
57
92
|
verifyRecipient={verifyRecipient}
|
|
58
93
|
/>
|
|
59
94
|
) : (
|
|
60
|
-
<LinkRecipientPermissions {...props}
|
|
95
|
+
<LinkRecipientPermissions {...props} />
|
|
61
96
|
)
|
|
62
97
|
|
|
63
98
|
return (
|
|
@@ -68,18 +103,18 @@ const LinkRecipient = props => {
|
|
|
68
103
|
<Icon icon={LinkIcon} />
|
|
69
104
|
</Avatar>
|
|
70
105
|
</ListItemIcon>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
{isReadOnly ? (
|
|
107
|
+
<LinkRecipientTextReadOnly
|
|
108
|
+
textPrimary={textPrimary}
|
|
109
|
+
textSecondary={textSecondary}
|
|
110
|
+
/>
|
|
111
|
+
) : (
|
|
112
|
+
<LinkRecipientText
|
|
113
|
+
onClick={() => setOpenShareRestrictionModal(true)}
|
|
114
|
+
textPrimary={textPrimary}
|
|
115
|
+
textSecondary={textSecondary}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
83
118
|
{RightPart}
|
|
84
119
|
{openShareRestrictionModal && (
|
|
85
120
|
<ShareRestrictionModal
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
divider
|
|
8
8
|
} from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
9
9
|
import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton'
|
|
10
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
10
11
|
import { useI18n } from 'twake-i18n'
|
|
11
12
|
|
|
12
13
|
import { revokeLink } from './actions/revokeLink'
|
|
@@ -17,7 +18,7 @@ import { checkIsReadOnlyPermissions } from '../../helpers/permissions'
|
|
|
17
18
|
import { useSharingContext } from '../../hooks/useSharingContext'
|
|
18
19
|
import { WRITE_PERMS, READ_ONLY_PERMS } from '../ShareRestrictionModal/helpers'
|
|
19
20
|
|
|
20
|
-
const LinkRecipientPermissions = ({
|
|
21
|
+
const LinkRecipientPermissions = ({ document, isReadOnly }) => {
|
|
21
22
|
const { t } = useI18n()
|
|
22
23
|
const buttonRef = useRef()
|
|
23
24
|
const [isMenuDisplayed, setMenuDisplayed] = useState(false)
|
|
@@ -56,30 +57,36 @@ const LinkRecipientPermissions = ({ className, document }) => {
|
|
|
56
57
|
handleRevocation
|
|
57
58
|
})
|
|
58
59
|
|
|
60
|
+
const shouldShowMenu = !isReadOnly
|
|
61
|
+
|
|
59
62
|
return (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
<>
|
|
64
|
+
{!shouldShowMenu && (
|
|
65
|
+
<Typography variant="body2">{t(`Share.type.${type}`)}</Typography>
|
|
66
|
+
)}
|
|
67
|
+
{shouldShowMenu && (
|
|
68
|
+
<>
|
|
69
|
+
<DropdownButton
|
|
70
|
+
ref={buttonRef}
|
|
71
|
+
textVariant="body2"
|
|
72
|
+
onClick={toggleMenu}
|
|
73
|
+
>
|
|
74
|
+
{t(`Share.type.${type}`)}
|
|
75
|
+
</DropdownButton>
|
|
76
|
+
<ActionsMenu
|
|
77
|
+
ref={buttonRef}
|
|
78
|
+
open={isMenuDisplayed}
|
|
79
|
+
actions={actions}
|
|
80
|
+
autoClose
|
|
81
|
+
onClose={hideMenu}
|
|
82
|
+
/>
|
|
83
|
+
</>
|
|
84
|
+
)}
|
|
85
|
+
</>
|
|
78
86
|
)
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
LinkRecipientPermissions.propTypes = {
|
|
82
|
-
className: PropTypes.string,
|
|
83
90
|
document: PropTypes.object.isRequired
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -21,11 +21,11 @@ const log = minilog('MemberRecipientPermissions')
|
|
|
21
21
|
|
|
22
22
|
const MemberRecipientPermissions = ({
|
|
23
23
|
isOwner,
|
|
24
|
+
isReadOnly,
|
|
24
25
|
status,
|
|
25
26
|
instance,
|
|
26
27
|
type,
|
|
27
28
|
document,
|
|
28
|
-
className,
|
|
29
29
|
onRevoke,
|
|
30
30
|
onRevokeSelf,
|
|
31
31
|
sharingId,
|
|
@@ -44,6 +44,7 @@ const MemberRecipientPermissions = ({
|
|
|
44
44
|
instance !== undefined && instance === client.options.uri
|
|
45
45
|
const contactIsOwner = status === 'owner'
|
|
46
46
|
const shouldShowMenu =
|
|
47
|
+
!isReadOnly &&
|
|
47
48
|
!revoking &&
|
|
48
49
|
!contactIsOwner &&
|
|
49
50
|
((instanceMatchesClient && !isOwner) || isOwner)
|
|
@@ -107,10 +108,14 @@ const MemberRecipientPermissions = ({
|
|
|
107
108
|
)
|
|
108
109
|
|
|
109
110
|
return (
|
|
110
|
-
|
|
111
|
+
<>
|
|
111
112
|
{revoking && <Spinner />}
|
|
112
|
-
{!shouldShowMenu &&
|
|
113
|
-
<Typography variant="body2">
|
|
113
|
+
{!shouldShowMenu && (
|
|
114
|
+
<Typography variant="body2">
|
|
115
|
+
{contactIsOwner
|
|
116
|
+
? t(`Share.status.${status}`)
|
|
117
|
+
: t(`Share.type.${type}`)}
|
|
118
|
+
</Typography>
|
|
114
119
|
)}
|
|
115
120
|
{shouldShowMenu && (
|
|
116
121
|
<>
|
|
@@ -140,7 +145,7 @@ const MemberRecipientPermissions = ({
|
|
|
140
145
|
</IconButton>
|
|
141
146
|
</>
|
|
142
147
|
)}
|
|
143
|
-
|
|
148
|
+
</>
|
|
144
149
|
)
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -10,6 +10,7 @@ const RecipientList = ({
|
|
|
10
10
|
recipientsToBeConfirmed,
|
|
11
11
|
isOwner,
|
|
12
12
|
isSharedDrive,
|
|
13
|
+
isReadOnly,
|
|
13
14
|
document,
|
|
14
15
|
documentType,
|
|
15
16
|
onRevoke,
|
|
@@ -49,6 +50,7 @@ const RecipientList = ({
|
|
|
49
50
|
key={recipient.index}
|
|
50
51
|
isOwner={isOwner}
|
|
51
52
|
isSharedDrive={isSharedDrive}
|
|
53
|
+
isReadOnly={isReadOnly}
|
|
52
54
|
document={document}
|
|
53
55
|
documentType={documentType}
|
|
54
56
|
onRevoke={onRevoke}
|
|
@@ -22,8 +22,6 @@ export const ShareModal = withLocales(props => {
|
|
|
22
22
|
isOwner,
|
|
23
23
|
canReshare,
|
|
24
24
|
documentType,
|
|
25
|
-
getOwner,
|
|
26
|
-
getSharingType,
|
|
27
25
|
getRecipients,
|
|
28
26
|
revokeSelf,
|
|
29
27
|
allLoaded
|
|
@@ -48,11 +46,9 @@ export const ShareModal = withLocales(props => {
|
|
|
48
46
|
|
|
49
47
|
return (
|
|
50
48
|
<SharingDetailsModal
|
|
49
|
+
recipients={getRecipients(document.id)}
|
|
51
50
|
document={document}
|
|
52
51
|
documentType={documentType}
|
|
53
|
-
owner={getOwner(document.id)}
|
|
54
|
-
sharingType={getSharingType(document.id)}
|
|
55
|
-
recipients={getRecipients(document.id)}
|
|
56
52
|
onRevoke={revokeSelf}
|
|
57
53
|
onRevokeSelf={handleRevokeSelf}
|
|
58
54
|
{...rest}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import cx from 'classnames'
|
|
2
1
|
import PropTypes from 'prop-types'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
|
|
5
4
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
6
|
-
import Divider from 'cozy-ui/transpiled/react/Divider'
|
|
7
|
-
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
8
5
|
import { useI18n } from 'twake-i18n'
|
|
9
6
|
|
|
10
|
-
import { getDisplayName } from '../../models'
|
|
11
7
|
import styles from '../../styles/share.styl'
|
|
12
|
-
import OwnerIdentity from '../Identity/OwnerIdentity'
|
|
13
8
|
import WhoHasAccess from '../WhoHasAccess'
|
|
14
9
|
|
|
15
10
|
export const SharingDetailsModal = ({
|
|
16
11
|
onClose,
|
|
17
|
-
sharingType,
|
|
18
|
-
owner,
|
|
19
12
|
recipients,
|
|
20
13
|
document,
|
|
21
14
|
documentType = 'Document',
|
|
22
15
|
onRevoke,
|
|
23
16
|
onRevokeSelf
|
|
24
17
|
}) => {
|
|
25
|
-
const { t
|
|
26
|
-
const { isMobile } = useBreakpoints()
|
|
18
|
+
const { t } = useI18n()
|
|
27
19
|
|
|
28
20
|
return (
|
|
29
21
|
<Dialog
|
|
@@ -34,50 +26,14 @@ export const SharingDetailsModal = ({
|
|
|
34
26
|
title={t(`${documentType}.share.details.title`)}
|
|
35
27
|
content={
|
|
36
28
|
<div className={styles['share-modal-content']}>
|
|
37
|
-
<div
|
|
38
|
-
className={cx(
|
|
39
|
-
styles['share-details'],
|
|
40
|
-
isMobile ? 'u-ph-1 u-pt-1-half' : 'u-ph-2 u-pt-1'
|
|
41
|
-
)}
|
|
42
|
-
>
|
|
43
|
-
{owner ? (
|
|
44
|
-
<OwnerIdentity
|
|
45
|
-
name={t(`${documentType}.share.sharedBy`, {
|
|
46
|
-
name: getDisplayName(owner)
|
|
47
|
-
})}
|
|
48
|
-
url={owner.instance}
|
|
49
|
-
/>
|
|
50
|
-
) : null}
|
|
51
|
-
<div className={styles['share-details-created']}>
|
|
52
|
-
{t(`${documentType}.share.details.createdAt`, {
|
|
53
|
-
date: f(document.created_at || null, 'do LLLL yyyy')
|
|
54
|
-
})}
|
|
55
|
-
</div>
|
|
56
|
-
<div className={styles['share-details-perm']}>
|
|
57
|
-
{t(
|
|
58
|
-
`${documentType}.share.details.${
|
|
59
|
-
sharingType === 'one-way' ? 'ro' : 'rw'
|
|
60
|
-
}`
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
<div className={styles['share-details-perm-desc']}>
|
|
64
|
-
{t(
|
|
65
|
-
`${documentType}.share.details.desc.${
|
|
66
|
-
sharingType === 'one-way' ? 'ro' : 'rw'
|
|
67
|
-
}`
|
|
68
|
-
)}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
<Divider className="u-mv-1" />
|
|
72
29
|
<WhoHasAccess
|
|
73
|
-
|
|
74
|
-
count: recipients.length
|
|
75
|
-
})}
|
|
30
|
+
isReadOnly
|
|
76
31
|
recipients={recipients}
|
|
77
32
|
document={document}
|
|
78
33
|
documentType={documentType}
|
|
79
34
|
onRevoke={onRevoke}
|
|
80
35
|
onRevokeSelf={onRevokeSelf}
|
|
36
|
+
link="ok"
|
|
81
37
|
/>
|
|
82
38
|
</div>
|
|
83
39
|
}
|
|
@@ -29,6 +29,7 @@ const RecipientWaitingForConfirmationAlert = ({ recipientsToBeConfirmed }) => {
|
|
|
29
29
|
const WhoHasAccess = ({
|
|
30
30
|
isOwner = false,
|
|
31
31
|
isSharedDrive = false,
|
|
32
|
+
isReadOnly = false,
|
|
32
33
|
showOwner = true,
|
|
33
34
|
recipients,
|
|
34
35
|
recipientsToBeConfirmed = [],
|
|
@@ -53,6 +54,7 @@ const WhoHasAccess = ({
|
|
|
53
54
|
<List>
|
|
54
55
|
{link && (
|
|
55
56
|
<LinkRecipient
|
|
57
|
+
isReadOnly={isReadOnly}
|
|
56
58
|
document={document}
|
|
57
59
|
documentType={documentType}
|
|
58
60
|
onRevoke={onRevoke}
|
|
@@ -69,6 +71,7 @@ const WhoHasAccess = ({
|
|
|
69
71
|
recipientsToBeConfirmed={recipientsToBeConfirmed}
|
|
70
72
|
isOwner={isOwner}
|
|
71
73
|
isSharedDrive={isSharedDrive}
|
|
74
|
+
isReadOnly={isReadOnly}
|
|
72
75
|
document={document}
|
|
73
76
|
documentType={documentType}
|
|
74
77
|
onRevoke={onRevoke}
|
package/src/state.js
CHANGED
|
@@ -351,7 +351,7 @@ export const canReshare = (state, docId, instanceUri) => {
|
|
|
351
351
|
const sharing = getDocumentSharing(state, docId)
|
|
352
352
|
const me = sharing.attributes.members.find(matchingInstanceName(instanceUri))
|
|
353
353
|
if (sharing.drive) {
|
|
354
|
-
return me && !me.read_only
|
|
354
|
+
return !sharing.org_drive && me && !me.read_only
|
|
355
355
|
} else {
|
|
356
356
|
return sharing.attributes.open_sharing === true && me && !me.read_only
|
|
357
357
|
}
|
package/src/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)
|