cozy-sharing 31.0.2 → 31.2.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 +30 -0
- package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +15 -16
- package/dist/components/FederatedFolder/FederatedFolderModal.js +78 -103
- package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +102 -292
- package/dist/components/Recipient/GroupRecipientPermissions.js +15 -11
- package/dist/components/Recipient/LinkRecipient.js +15 -11
- package/dist/components/Recipient/LinkRecipientLite.js +1 -1
- package/dist/components/Recipient/LinkRecipientPermissions.js +2 -1
- package/dist/components/Recipient/MemberRecipient.spec.js +8 -10
- package/dist/components/Recipient/MemberRecipientLite.js +1 -1
- package/dist/components/Recipient/MemberRecipientPermissions.js +16 -12
- package/dist/components/Recipient/MemberRecipientPermissions.spec.js +62 -50
- package/dist/components/Recipient/RecipientConfirm.js +0 -5
- package/dist/components/ShareAutosuggest.js +9 -4
- package/dist/components/ShareByEmail.js +29 -274
- package/dist/components/ShareByEmail.spec.js +52 -230
- package/dist/components/ShareByLink.js +1 -3
- package/dist/components/ShareDialogCozyToCozy.js +169 -35
- package/dist/components/ShareDialogCozyToCozy.spec.js +123 -36
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +13 -3
- package/dist/components/ShareModal/SharingDetailsModal.js +0 -5
- package/dist/components/ShareRecipientsInput.js +6 -3
- package/dist/components/SharedDrive/SharedDriveForm.js +17 -25
- package/dist/components/SharedDrive/SharedDriveModal.js +1 -1
- package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +15 -10
- package/dist/components/SharedDrive/useSharedDrive.js +33 -57
- package/dist/components/SharedDrive/useSharedDrive.spec.js +29 -93
- package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +15 -26
- package/dist/components/Sharetypeselect.js +85 -90
- package/dist/hooks/usePendingRecipients.js +20 -0
- package/dist/hooks/usePendingRecipients.spec.js +30 -0
- package/dist/styles/autosuggest.styl +8 -2
- package/dist/styles/share.styl +0 -39
- package/dist/stylesheet.css +8 -36
- package/locales/en.json +14 -44
- package/locales/fr.json +14 -44
- package/locales/ru.json +14 -44
- package/locales/vi.json +14 -42
- package/package.json +2 -2
- package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +14 -15
- package/src/components/FederatedFolder/FederatedFolderModal.jsx +50 -67
- package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +63 -186
- package/src/components/Recipient/GroupRecipientPermissions.jsx +15 -13
- package/src/components/Recipient/LinkRecipient.jsx +9 -9
- package/src/components/Recipient/LinkRecipientLite.jsx +1 -3
- package/src/components/Recipient/LinkRecipientPermissions.jsx +2 -1
- package/src/components/Recipient/MemberRecipient.spec.jsx +4 -6
- package/src/components/Recipient/MemberRecipientLite.jsx +2 -2
- package/src/components/Recipient/MemberRecipientPermissions.jsx +16 -21
- package/src/components/Recipient/MemberRecipientPermissions.spec.jsx +21 -23
- package/src/components/ShareAutosuggest.jsx +7 -2
- package/src/components/ShareByEmail.jsx +35 -186
- package/src/components/ShareByEmail.spec.jsx +22 -173
- package/src/components/ShareByLink.jsx +1 -7
- package/src/components/ShareDialogCozyToCozy.jsx +171 -38
- package/src/components/ShareDialogCozyToCozy.spec.jsx +67 -1
- package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +11 -1
- package/src/components/ShareRecipientsInput.jsx +5 -2
- package/src/components/SharedDrive/SharedDriveForm.jsx +16 -25
- package/src/components/SharedDrive/SharedDriveModal.jsx +1 -1
- package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +15 -17
- package/src/components/SharedDrive/useSharedDrive.js +24 -50
- package/src/components/SharedDrive/useSharedDrive.spec.js +19 -67
- package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +15 -29
- package/src/components/Sharetypeselect.jsx +75 -58
- package/src/hooks/usePendingRecipients.js +13 -0
- package/src/hooks/usePendingRecipients.spec.js +21 -0
- package/src/styles/autosuggest.styl +8 -2
- package/src/styles/share.styl +0 -39
- package/dist/components/Recipient/actions/revokeGroup.js +0 -42
- package/dist/components/Recipient/actions/revokeMember.js +0 -42
- package/dist/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
- package/dist/components/SharedDrive/helpers.js +0 -102
- package/dist/components/SharedDrive/helpers.spec.js +0 -227
- package/dist/components/Sharesubmit.js +0 -28
- package/src/components/Recipient/actions/revokeGroup.js +0 -42
- package/src/components/Recipient/actions/revokeMember.js +0 -42
- package/src/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
- package/src/components/SharedDrive/helpers.js +0 -108
- package/src/components/SharedDrive/helpers.spec.js +0 -177
- package/src/components/Sharesubmit.jsx +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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
|
+
# [31.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@31.1.0...cozy-sharing@31.2.0) (2026-05-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Avoid blinking recipient in share modals ([8e71bc8](https://github.com/cozy/cozy-libs/commit/8e71bc8e6a924340100247523f75d2c18912739a))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- Add usePendingRecipients hook ([7f8a96e](https://github.com/cozy/cozy-libs/commit/7f8a96eb35044fb6d001bf7460a84ceda34fa130))
|
|
15
|
+
- Delete special shared folder recipient management ([6691c99](https://github.com/cozy/cozy-libs/commit/6691c99f698b1db6b537f5ac0a0ab69303986501))
|
|
16
|
+
- Implement usePendingRecipients for FederatedFolder modal ([3564cb9](https://github.com/cozy/cozy-libs/commit/3564cb9aba9647fc63870d433cd80cf119e749ae))
|
|
17
|
+
- Implement usePendingRecipients for SharedDriveForm ([129a033](https://github.com/cozy/cozy-libs/commit/129a03369a6be34ec829b74d838245e66edab4de))
|
|
18
|
+
- Implement usePendingRecipients for ShareDialogCozyToCozy modal ([2d5d4c2](https://github.com/cozy/cozy-libs/commit/2d5d4c2c1419e50c9f24f8cbca0cb547d1d6bb0d))
|
|
19
|
+
- Update CozyToCozy dialog to new UI and wording ([e1ec36b](https://github.com/cozy/cozy-libs/commit/e1ec36b363d88e940b42f54b281485a236775263))
|
|
20
|
+
- Update ShareTypeSelect UI ([515aab4](https://github.com/cozy/cozy-libs/commit/515aab437afa502dcacd1debb932794017519845))
|
|
21
|
+
|
|
22
|
+
# [31.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@31.0.2...cozy-sharing@31.1.0) (2026-05-07)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- Autoclose sharing link permission menu ([82f6b62](https://github.com/cozy/cozy-libs/commit/82f6b62c78232805150e8c927955bb7eeb108ad4))
|
|
27
|
+
- Fix hover issue in link recipient text ([dce027c](https://github.com/cozy/cozy-libs/commit/dce027c16eecf8f3309da73a1dd01d537a2cef47))
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
- Revoke member or group with button instead of action ([3fa0c4d](https://github.com/cozy/cozy-libs/commit/3fa0c4d3035d57fa65e231fbbddc5b06955b3ecb))
|
|
32
|
+
- Update permission menu UI ([bc0c0ad](https://github.com/cozy/cozy-libs/commit/bc0c0ade86d86e82299397c09cdc5f4c19c1c4ac))
|
|
33
|
+
- Update SharedDriveForm UI ([b3ab3ff](https://github.com/cozy/cozy-libs/commit/b3ab3ffd3881ccae74c1e3486706e7c108ed151b))
|
|
34
|
+
- Update SharedDriveForm wording ([c46750b](https://github.com/cozy/cozy-libs/commit/c46750be56cbc0c99b2c3f46b069d361cadddb82))
|
|
35
|
+
|
|
6
36
|
## [31.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@31.0.1...cozy-sharing@31.0.2) (2026-05-07)
|
|
7
37
|
|
|
8
38
|
### Bug Fixes
|
|
@@ -6,19 +6,19 @@ import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolde
|
|
|
6
6
|
export var DumbFederatedFolderModal = withLocales(function (_ref) {
|
|
7
7
|
var title = _ref.title,
|
|
8
8
|
document = _ref.document,
|
|
9
|
-
createContact = _ref.createContact,
|
|
10
9
|
recipients = _ref.recipients,
|
|
11
|
-
readOnlyRecipients = _ref.readOnlyRecipients,
|
|
12
10
|
currentRecipients = _ref.currentRecipients,
|
|
13
11
|
onRevoke = _ref.onRevoke,
|
|
14
|
-
onSetType = _ref.onSetType,
|
|
15
12
|
onSend = _ref.onSend,
|
|
16
13
|
onClose = _ref.onClose,
|
|
17
|
-
onShare = _ref.onShare,
|
|
18
14
|
sharingLink = _ref.sharingLink,
|
|
19
15
|
showShareByEmail = _ref.showShareByEmail,
|
|
20
16
|
autoOpenShareRestriction = _ref.autoOpenShareRestriction,
|
|
21
|
-
showGenerateLinkButton = _ref.showGenerateLinkButton
|
|
17
|
+
showGenerateLinkButton = _ref.showGenerateLinkButton,
|
|
18
|
+
pendingRecipients = _ref.pendingRecipients,
|
|
19
|
+
onPendingRecipientsChange = _ref.onPendingRecipientsChange,
|
|
20
|
+
selectedOption = _ref.selectedOption,
|
|
21
|
+
onSelectedOptionChange = _ref.onSelectedOptionChange;
|
|
22
22
|
|
|
23
23
|
var _useI18n = useI18n(),
|
|
24
24
|
t = _useI18n.t;
|
|
@@ -26,40 +26,39 @@ export var DumbFederatedFolderModal = withLocales(function (_ref) {
|
|
|
26
26
|
return /*#__PURE__*/React.createElement(DumbBatchSharedFolderModal, {
|
|
27
27
|
title: title,
|
|
28
28
|
document: document,
|
|
29
|
-
createContact: createContact,
|
|
30
29
|
recipients: recipients,
|
|
31
|
-
readOnlyRecipients: readOnlyRecipients,
|
|
32
30
|
currentRecipients: currentRecipients,
|
|
33
31
|
onRevoke: onRevoke,
|
|
34
|
-
onSetType: onSetType,
|
|
35
32
|
onSend: onSend,
|
|
36
33
|
onClose: onClose,
|
|
37
|
-
onShare: onShare,
|
|
38
34
|
sharingLink: sharingLink,
|
|
39
35
|
showNameField: false,
|
|
40
36
|
addPeopleLabel: t('FederatedFolder.addPeople'),
|
|
41
|
-
addButtonLabel: t('FederatedFolder.add'),
|
|
42
37
|
shareLabel: t('FederatedFolder.share'),
|
|
43
38
|
showShareByEmail: showShareByEmail,
|
|
44
39
|
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
45
|
-
showGenerateLinkButton: showGenerateLinkButton
|
|
40
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
41
|
+
pendingRecipients: pendingRecipients,
|
|
42
|
+
onPendingRecipientsChange: onPendingRecipientsChange,
|
|
43
|
+
selectedOption: selectedOption,
|
|
44
|
+
onSelectedOptionChange: onSelectedOptionChange
|
|
46
45
|
});
|
|
47
46
|
});
|
|
48
47
|
DumbFederatedFolderModal.propTypes = {
|
|
49
48
|
title: PropTypes.string,
|
|
50
49
|
document: PropTypes.object,
|
|
51
|
-
createContact: PropTypes.func.isRequired,
|
|
52
50
|
recipients: PropTypes.array,
|
|
53
|
-
readOnlyRecipients: PropTypes.array,
|
|
54
51
|
currentRecipients: PropTypes.array,
|
|
55
52
|
onRevoke: PropTypes.func.isRequired,
|
|
56
|
-
onSetType: PropTypes.func.isRequired,
|
|
57
53
|
onSend: PropTypes.func.isRequired,
|
|
58
54
|
onClose: PropTypes.func.isRequired,
|
|
59
|
-
onShare: PropTypes.func.isRequired,
|
|
60
55
|
sharingLink: PropTypes.string,
|
|
61
56
|
showShareByEmail: PropTypes.bool,
|
|
62
57
|
autoOpenShareRestriction: PropTypes.bool,
|
|
63
|
-
showGenerateLinkButton: PropTypes.bool
|
|
58
|
+
showGenerateLinkButton: PropTypes.bool,
|
|
59
|
+
pendingRecipients: PropTypes.array.isRequired,
|
|
60
|
+
onPendingRecipientsChange: PropTypes.func.isRequired,
|
|
61
|
+
selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']).isRequired,
|
|
62
|
+
onSelectedOptionChange: PropTypes.func.isRequired
|
|
64
63
|
};
|
|
65
64
|
export default DumbFederatedFolderModal;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import React, {
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
7
6
|
import { useClient } from 'cozy-client';
|
|
8
7
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
|
|
9
8
|
import { useI18n } from 'twake-i18n';
|
|
10
9
|
import { DumbFederatedFolderModal } from './DumbFederatedFolderModal';
|
|
10
|
+
import { getOrCreateFromArray } from '../../helpers/contacts';
|
|
11
11
|
import withLocales from '../../hoc/withLocales';
|
|
12
|
+
import { usePendingRecipients } from '../../hooks/usePendingRecipients';
|
|
12
13
|
import { useSharingContext } from '../../hooks/useSharingContext';
|
|
13
|
-
import { formatRecipients, mergeAndDeduplicateRecipients, moveRecipientToReadWrite, moveRecipientToReadOnly, RECIPIENT_INDEX_PREFIX } from '../SharedDrive/helpers';
|
|
14
14
|
export var FederatedFolderModal = withLocales(function (_ref) {
|
|
15
15
|
var onClose = _ref.onClose,
|
|
16
16
|
existingDocument = _ref.document,
|
|
@@ -39,6 +39,33 @@ export var FederatedFolderModal = withLocales(function (_ref) {
|
|
|
39
39
|
sharingLink = _useState2[0],
|
|
40
40
|
setSharingLink = _useState2[1];
|
|
41
41
|
|
|
42
|
+
var _usePendingRecipients = usePendingRecipients(),
|
|
43
|
+
pendingRecipients = _usePendingRecipients.pendingRecipients,
|
|
44
|
+
setPendingRecipients = _usePendingRecipients.setPendingRecipients,
|
|
45
|
+
selectedOption = _usePendingRecipients.selectedOption,
|
|
46
|
+
setSelectedOption = _usePendingRecipients.setSelectedOption; // share from CozyProvider is wired to callbacks and realtime that
|
|
47
|
+
// makes existingDocument and existingRecipients reactive to changes.
|
|
48
|
+
// But we want it to be reactive only when we revoke a member. When we add member
|
|
49
|
+
// we close the popup and we do not want to see briefly the new contacts added
|
|
50
|
+
// in members before the modal closes. That's why when clicking on "Share"
|
|
51
|
+
// we do not use the reactive existingDocument and existingRecipients.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var _useState3 = useState(false),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
isSending = _useState4[0],
|
|
57
|
+
setIsSending = _useState4[1];
|
|
58
|
+
|
|
59
|
+
var _useState5 = useState(null),
|
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
|
+
frozenDoc = _useState6[0],
|
|
62
|
+
setFrozenDoc = _useState6[1];
|
|
63
|
+
|
|
64
|
+
var _useState7 = useState(null),
|
|
65
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
66
|
+
frozenRecipients = _useState8[0],
|
|
67
|
+
setFrozenRecipients = _useState8[1];
|
|
68
|
+
|
|
42
69
|
var documentPermissions = existingDocument ? getDocumentPermissions(existingDocument._id) : [];
|
|
43
70
|
useEffect(function () {
|
|
44
71
|
var fetchSharingLink = /*#__PURE__*/function () {
|
|
@@ -86,68 +113,75 @@ export var FederatedFolderModal = withLocales(function (_ref) {
|
|
|
86
113
|
|
|
87
114
|
fetchSharingLink();
|
|
88
115
|
}, [existingDocument, documentPermissions, getFederatedShareLink, getSharingLink, getOwner, getSharingById]);
|
|
89
|
-
|
|
90
|
-
var _useState3 = useState({
|
|
91
|
-
recipients: [],
|
|
92
|
-
readOnlyRecipients: []
|
|
93
|
-
}),
|
|
94
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
95
|
-
federatedRecipients = _useState4[0],
|
|
96
|
-
setFederatedRecipients = _useState4[1];
|
|
97
|
-
|
|
98
|
-
var _useState5 = useState((existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.name) || ''),
|
|
99
|
-
_useState6 = _slicedToArray(_useState5, 1),
|
|
100
|
-
folderName = _useState6[0];
|
|
101
|
-
|
|
102
|
-
var onShare = function onShare(params) {
|
|
103
|
-
setFederatedRecipients(function (prev) {
|
|
104
|
-
return {
|
|
105
|
-
recipients: mergeAndDeduplicateRecipients([prev.recipients, params.recipients || []]),
|
|
106
|
-
readOnlyRecipients: mergeAndDeduplicateRecipients([prev.readOnlyRecipients, params.readOnlyRecipients || []])
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
};
|
|
116
|
+
var folderName = (existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.name) || '';
|
|
110
117
|
|
|
111
118
|
var onSend = /*#__PURE__*/function () {
|
|
112
119
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
120
|
+
var contacts, readWriteRecipients, readOnlyRecipients;
|
|
113
121
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
114
122
|
while (1) switch (_context2.prev = _context2.next) {
|
|
115
123
|
case 0:
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
if (!(pendingRecipients.length === 0)) {
|
|
125
|
+
_context2.next = 3;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
onClose();
|
|
130
|
+
return _context2.abrupt("return");
|
|
131
|
+
|
|
132
|
+
case 3:
|
|
133
|
+
setIsSending(true);
|
|
134
|
+
setFrozenDoc(existingDocument);
|
|
135
|
+
setFrozenRecipients(existingRecipients);
|
|
136
|
+
_context2.prev = 6;
|
|
137
|
+
_context2.next = 9;
|
|
138
|
+
return getOrCreateFromArray(client, pendingRecipients, function (contact) {
|
|
139
|
+
return client.create('io.cozy.contacts', contact);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
case 9:
|
|
143
|
+
contacts = _context2.sent;
|
|
144
|
+
readWriteRecipients = selectedOption === 'readOnly' ? [] : contacts;
|
|
145
|
+
readOnlyRecipients = selectedOption === 'readOnly' ? contacts : [];
|
|
146
|
+
_context2.next = 14;
|
|
118
147
|
return share({
|
|
119
148
|
description: folderName,
|
|
120
149
|
document: existingDocument,
|
|
121
|
-
recipients:
|
|
122
|
-
readOnlyRecipients:
|
|
150
|
+
recipients: readWriteRecipients,
|
|
151
|
+
readOnlyRecipients: readOnlyRecipients,
|
|
123
152
|
sharedDrive: true,
|
|
124
153
|
openSharing: false
|
|
125
154
|
});
|
|
126
155
|
|
|
127
|
-
case
|
|
156
|
+
case 14:
|
|
128
157
|
showAlert({
|
|
129
158
|
message: t('FederatedFolder.successNotification'),
|
|
130
159
|
severity: 'success',
|
|
131
160
|
variant: 'filled'
|
|
132
161
|
});
|
|
133
162
|
onClose();
|
|
134
|
-
_context2.next =
|
|
163
|
+
_context2.next = 21;
|
|
135
164
|
break;
|
|
136
165
|
|
|
137
|
-
case
|
|
138
|
-
_context2.prev =
|
|
139
|
-
_context2.t0 = _context2["catch"](
|
|
166
|
+
case 18:
|
|
167
|
+
_context2.prev = 18;
|
|
168
|
+
_context2.t0 = _context2["catch"](6);
|
|
140
169
|
showAlert({
|
|
141
170
|
message: t('FederatedFolder.errorNotification'),
|
|
142
171
|
severity: 'error',
|
|
143
172
|
variant: 'filled'
|
|
144
173
|
});
|
|
145
174
|
|
|
146
|
-
case
|
|
175
|
+
case 21:
|
|
176
|
+
_context2.prev = 21;
|
|
177
|
+
setIsSending(false);
|
|
178
|
+
return _context2.finish(21);
|
|
179
|
+
|
|
180
|
+
case 24:
|
|
147
181
|
case "end":
|
|
148
182
|
return _context2.stop();
|
|
149
183
|
}
|
|
150
|
-
}, _callee2, null, [[
|
|
184
|
+
}, _callee2, null, [[6, 18, 21, 24]]);
|
|
151
185
|
}));
|
|
152
186
|
|
|
153
187
|
return function onSend() {
|
|
@@ -155,86 +189,27 @@ export var FederatedFolderModal = withLocales(function (_ref) {
|
|
|
155
189
|
};
|
|
156
190
|
}();
|
|
157
191
|
|
|
158
|
-
var onSetType = function onSetType(index, newType) {
|
|
159
|
-
var _id = index.split(RECIPIENT_INDEX_PREFIX)[1];
|
|
160
|
-
|
|
161
|
-
if (newType === 'two-way') {
|
|
162
|
-
setFederatedRecipients(function (prev) {
|
|
163
|
-
return moveRecipientToReadWrite(prev, _id);
|
|
164
|
-
});
|
|
165
|
-
} else {
|
|
166
|
-
setFederatedRecipients(function (prev) {
|
|
167
|
-
return moveRecipientToReadOnly(prev, _id);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
var onRevoke = /*#__PURE__*/function () {
|
|
173
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentOrIndex, sharingId, memberIndex) {
|
|
174
|
-
var _id;
|
|
175
|
-
|
|
176
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
177
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
178
|
-
case 0:
|
|
179
|
-
if (!(typeof documentOrIndex === 'string' && documentOrIndex.startsWith(RECIPIENT_INDEX_PREFIX))) {
|
|
180
|
-
_context3.next = 5;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
_id = documentOrIndex.split(RECIPIENT_INDEX_PREFIX)[1];
|
|
185
|
-
setFederatedRecipients(function (prev) {
|
|
186
|
-
return {
|
|
187
|
-
recipients: prev.recipients.filter(function (r) {
|
|
188
|
-
return r._id !== _id;
|
|
189
|
-
}),
|
|
190
|
-
readOnlyRecipients: prev.readOnlyRecipients.filter(function (r) {
|
|
191
|
-
return r._id !== _id;
|
|
192
|
-
})
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
_context3.next = 7;
|
|
196
|
-
break;
|
|
197
|
-
|
|
198
|
-
case 5:
|
|
199
|
-
_context3.next = 7;
|
|
200
|
-
return revoke(documentOrIndex, sharingId, memberIndex);
|
|
201
|
-
|
|
202
|
-
case 7:
|
|
203
|
-
case "end":
|
|
204
|
-
return _context3.stop();
|
|
205
|
-
}
|
|
206
|
-
}, _callee3);
|
|
207
|
-
}));
|
|
208
|
-
|
|
209
|
-
return function onRevoke(_x, _x2, _x3) {
|
|
210
|
-
return _ref4.apply(this, arguments);
|
|
211
|
-
};
|
|
212
|
-
}();
|
|
213
|
-
|
|
214
192
|
var existingRecipients = existingDocument ? getRecipients(existingDocument._id) : [];
|
|
215
|
-
var recipients = [].concat(_toConsumableArray(existingRecipients), _toConsumableArray(formatRecipients(federatedRecipients)));
|
|
216
193
|
var modalTitle = t('FederatedFolder.shareTitle', {
|
|
217
194
|
name: folderName
|
|
218
195
|
});
|
|
219
196
|
var isSharedDrive = Boolean(existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.driveId);
|
|
220
197
|
return /*#__PURE__*/React.createElement(DumbFederatedFolderModal, {
|
|
221
198
|
title: modalTitle,
|
|
222
|
-
document: existingDocument,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
recipients: recipients,
|
|
227
|
-
readOnlyRecipients: federatedRecipients.readOnlyRecipients,
|
|
228
|
-
currentRecipients: existingRecipients,
|
|
229
|
-
onRevoke: onRevoke,
|
|
230
|
-
onSetType: onSetType,
|
|
199
|
+
document: isSending ? frozenDoc : existingDocument,
|
|
200
|
+
recipients: isSending ? frozenRecipients : existingRecipients,
|
|
201
|
+
currentRecipients: isSending ? frozenRecipients : existingRecipients,
|
|
202
|
+
onRevoke: revoke,
|
|
231
203
|
onSend: onSend,
|
|
232
204
|
onClose: onClose,
|
|
233
|
-
onShare: onShare,
|
|
234
205
|
sharingLink: sharingLink,
|
|
235
206
|
showShareByEmail: !isSharedDrive,
|
|
236
207
|
autoOpenShareRestriction: autoOpenShareRestriction,
|
|
237
|
-
showGenerateLinkButton: showGenerateLinkButton
|
|
208
|
+
showGenerateLinkButton: showGenerateLinkButton,
|
|
209
|
+
pendingRecipients: pendingRecipients,
|
|
210
|
+
onPendingRecipientsChange: setPendingRecipients,
|
|
211
|
+
selectedOption: selectedOption,
|
|
212
|
+
onSelectedOptionChange: setSelectedOption
|
|
238
213
|
});
|
|
239
214
|
});
|
|
240
215
|
FederatedFolderModal.propTypes = {
|