cozy-sharing 4.9.0 → 6.0.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 +90 -0
- package/dist/SharedRecipients.js +1 -1
- package/dist/SharedStatus.js +1 -1
- package/dist/SharingBanner/hooks/useSharingInfos.js +1 -1
- package/dist/SharingDetailsModal.js +1 -1
- package/dist/SharingOwnerAvatar.js +1 -1
- package/dist/SharingProvider.js +21 -8
- package/dist/components/ContactSuggestion.js +15 -27
- package/dist/components/EditLinkPermissionDialog.js +72 -0
- package/dist/components/EditLinkPermissionDialog.spec.js +48 -0
- package/dist/components/EditableSharingModal.js +15 -62
- package/dist/components/{AvatarPlusX.js → Recipient/AvatarPlusX.js} +1 -1
- package/dist/components/{Identity.js → Recipient/Identity.js} +17 -16
- package/dist/components/Recipient/LinkRecipient.js +72 -0
- package/dist/components/Recipient/LinkRecipientPermissions.js +159 -0
- package/dist/components/Recipient/OwnerIdentity.js +44 -0
- package/dist/components/Recipient/Recipient.js +72 -0
- package/dist/components/{Recipient.spec.js → Recipient/Recipient.spec.js} +4 -45
- package/dist/components/Recipient/RecipientAvatar.js +33 -0
- package/dist/components/Recipient/RecipientConfirm.js +63 -0
- package/dist/components/Recipient/RecipientPermissions.js +126 -0
- package/dist/components/Recipient/RecipientPlusX.js +45 -0
- package/dist/components/Recipient/RecipientStatus.js +64 -0
- package/dist/components/Recipient/RecipientWithoutStatus.js +45 -0
- package/dist/components/Recipient/RecipientsAvatars.js +100 -0
- package/dist/components/{RecipientsAvatars.spec.js → Recipient/RecipientsAvatars.spec.js} +43 -2
- package/dist/components/{recipient.styl → Recipient/recipient.styl} +6 -2
- package/dist/components/ShareAutosuggest.js +176 -252
- package/dist/components/ShareAutosuggest.spec.js +3 -2
- package/dist/components/ShareByEmail.js +142 -193
- package/dist/components/ShareByEmail.spec.js +42 -23
- package/dist/components/ShareByLink.js +251 -357
- package/dist/components/ShareDialogCozyToCozy.js +16 -4
- package/dist/components/ShareDialogCozyToCozy.spec.js +12 -1
- package/dist/components/ShareDialogOnlyByLink.js +23 -10
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +7 -7
- package/dist/components/ShareModal.js +5 -1
- package/dist/components/ShareRecipientsInput.js +44 -128
- package/dist/components/WhoHasAccess.js +43 -5
- package/dist/components/WhoHasAccessLight.js +3 -19
- package/dist/components/autosuggest.styl +21 -36
- package/dist/components/badge.styl +1 -1
- package/dist/helpers/documentType.js +6 -0
- package/dist/helpers/hooks.js +8 -1
- package/dist/helpers/link.js +5 -0
- package/dist/helpers/permissions.js +8 -0
- package/dist/helpers/recipients.js +24 -0
- package/dist/helpers/sharings.js +72 -53
- package/dist/helpers/synchronousJobQueue.js +67 -0
- package/dist/helpers/synchronousJobQueue.spec.js +97 -0
- package/dist/index.js +2 -1
- package/dist/queries/queries.js +72 -0
- package/dist/share.styl +0 -15
- package/dist/stylesheet.css +68 -93
- package/locales/en.json +29 -41
- package/locales/fr.json +26 -39
- package/package.json +10 -10
- package/src/SharedRecipients.jsx +1 -1
- package/src/SharedStatus.jsx +1 -1
- package/src/SharingBanner/hooks/useSharingInfos.jsx +1 -1
- package/src/SharingDetailsModal.jsx +1 -1
- package/src/SharingOwnerAvatar.jsx +1 -1
- package/src/SharingProvider.jsx +17 -4
- package/src/components/ContactSuggestion.jsx +25 -10
- package/src/components/EditLinkPermissionDialog.jsx +89 -0
- package/src/components/EditLinkPermissionDialog.spec.jsx +52 -0
- package/src/components/EditableSharingModal.jsx +58 -100
- package/src/components/{AvatarPlusX.jsx → Recipient/AvatarPlusX.jsx} +1 -1
- package/src/components/{Identity.jsx → Recipient/Identity.jsx} +0 -0
- package/src/components/Recipient/LinkRecipient.jsx +59 -0
- package/src/components/Recipient/LinkRecipientPermissions.jsx +157 -0
- package/src/components/Recipient/OwnerIdentity.jsx +20 -0
- package/src/components/Recipient/Recipient.jsx +79 -0
- package/src/components/{Recipient.spec.jsx → Recipient/Recipient.spec.jsx} +4 -42
- package/src/components/Recipient/RecipientAvatar.jsx +38 -0
- package/src/components/Recipient/RecipientConfirm.jsx +37 -0
- package/src/components/Recipient/RecipientPermissions.jsx +114 -0
- package/src/components/Recipient/RecipientPlusX.jsx +28 -0
- package/src/components/Recipient/RecipientStatus.jsx +48 -0
- package/src/components/Recipient/RecipientWithoutStatus.jsx +21 -0
- package/src/components/Recipient/RecipientsAvatars.jsx +108 -0
- package/src/components/{RecipientsAvatars.spec.jsx → Recipient/RecipientsAvatars.spec.jsx} +43 -2
- package/src/components/{recipient.styl → Recipient/recipient.styl} +6 -2
- package/src/components/ShareAutosuggest.jsx +136 -127
- package/src/components/ShareAutosuggest.spec.jsx +12 -8
- package/src/components/ShareByEmail.jsx +65 -90
- package/src/components/ShareByEmail.spec.jsx +39 -11
- package/src/components/ShareByLink.jsx +146 -238
- package/src/components/ShareDialogCozyToCozy.jsx +14 -2
- package/src/components/ShareDialogCozyToCozy.spec.jsx +8 -1
- package/src/components/ShareDialogOnlyByLink.jsx +30 -13
- package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +5 -5
- package/src/components/ShareModal.jsx +5 -1
- package/src/components/ShareRecipientsInput.jsx +30 -44
- package/src/components/WhoHasAccess.jsx +85 -27
- package/src/components/WhoHasAccessLight.jsx +2 -1
- package/src/components/__snapshots__/ContactSuggestion.spec.jsx.snap +915 -132
- package/src/components/__snapshots__/ShareRecipientsInput.spec.jsx.snap +86 -102
- package/src/components/autosuggest.styl +21 -36
- package/src/components/badge.styl +1 -1
- package/src/helpers/documentType.js +6 -0
- package/src/helpers/hooks.js +11 -1
- package/src/helpers/link.js +4 -0
- package/src/helpers/permissions.js +15 -0
- package/src/helpers/recipients.js +21 -0
- package/src/helpers/sharings.js +15 -12
- package/src/helpers/synchronousJobQueue.js +22 -0
- package/src/helpers/synchronousJobQueue.spec.js +75 -0
- package/src/index.jsx +1 -0
- package/src/queries/queries.js +75 -0
- package/src/share.styl +0 -15
- package/dist/SharingBanner/helpers/queries.js +0 -12
- package/dist/components/ContactsAndGroupsDataLoader.js +0 -50
- package/dist/components/Recipient.js +0 -450
- package/src/SharingBanner/helpers/queries.js +0 -14
- package/src/components/ContactsAndGroupsDataLoader.jsx +0 -30
- package/src/components/Recipient.jsx +0 -415
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,96 @@
|
|
|
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
|
+
# 6.0.0 (2023-01-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* ActionMenu could not be closed after closing and reopening modal ([f9c638f](https://github.com/cozy/cozy-libs/commit/f9c638f11eec4c618985e70a6764c6c22c3ed0b0))
|
|
12
|
+
* Allow content to go full size in share by email select box ([6dc210e](https://github.com/cozy/cozy-libs/commit/6dc210edecefe7dbddc79c6b64a1b8b03797fdc0))
|
|
13
|
+
* Copy to clipboard when link is created ([517ce10](https://github.com/cozy/cozy-libs/commit/517ce10e76beee9067132a2323260c38fb3aec3e))
|
|
14
|
+
* Don't call PermissionCol.findApps ([08073da](https://github.com/cozy/cozy-libs/commit/08073da3271c906fd45e74928efe7e742ed7dc35)), closes [cozy/cozy-client#1293](https://github.com/cozy/cozy-client/issues/1293)
|
|
15
|
+
* Highlight again current suggestion in grey ([122491a](https://github.com/cozy/cozy-libs/commit/122491a75b8104e78a75587ec91579d1f2bbe6b1))
|
|
16
|
+
* Realtime order issue caused invalid recipient status ([8ec1f4b](https://github.com/cozy/cozy-libs/commit/8ec1f4b68298530241cd3119402a60c1f29cf6f5))
|
|
17
|
+
* Remove duplicate use of t causing translation warnings ([8aef46d](https://github.com/cozy/cozy-libs/commit/8aef46d3421d8506e2ee63d9952c0f2d7371e022))
|
|
18
|
+
* Remove pick on input blur when a suggestion is highlighted ([5f5cc21](https://github.com/cozy/cozy-libs/commit/5f5cc21eb7b4da6e116d18dd60c128a4d2525ed2))
|
|
19
|
+
* Update wording to see file/folder ([b815daa](https://github.com/cozy/cozy-libs/commit/b815daa7964437f4129d512867e5c3dc26022397))
|
|
20
|
+
* Use strategy: fixed in popper options to show overflow ([73b159a](https://github.com/cozy/cozy-libs/commit/73b159aa91fd4feb84b2377d10001774c30ad7df))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Code Refactoring
|
|
24
|
+
|
|
25
|
+
* Move Recipient related components in a Recipient folder ([518bff1](https://github.com/cozy/cozy-libs/commit/518bff1748f9e8466203ec5f3152ac653253b439))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* Accept options argument in shareByLink function ([93d75d8](https://github.com/cozy/cozy-libs/commit/93d75d8cb80a630dd1160899015916fff9fc1828))
|
|
31
|
+
* Add "Who has access?" title in Dialog ([33cb6b3](https://github.com/cozy/cozy-libs/commit/33cb6b320220e239cc030c98729d984deae62ab8))
|
|
32
|
+
* Add and export DOCUMENT_TYPE constant ([959881a](https://github.com/cozy/cozy-libs/commit/959881a654d7605267914dde14d038877bfd412f))
|
|
33
|
+
* Add SynchronousJobQueue ([b654c40](https://github.com/cozy/cozy-libs/commit/b654c40c9f81a7931476bab82fe54033a24fbaf0))
|
|
34
|
+
* Add usePrevious hook ([32e4a26](https://github.com/cozy/cozy-libs/commit/32e4a2624fb8865c42209164f7fba66470ac19b2))
|
|
35
|
+
* Align horizontally share by email buttons on mobile ([bd212b6](https://github.com/cozy/cozy-libs/commit/bd212b61ab9ee40f97bd3386f93b1629727640e9))
|
|
36
|
+
* **ContactSuggestion:** Use ListItemText from cozy-ui ([2680feb](https://github.com/cozy/cozy-libs/commit/2680febce956d0b1cfdfbfa92bf7e7bc17208d87))
|
|
37
|
+
* Create sharing link after choosing permission in modal ([554b912](https://github.com/cozy/cozy-libs/commit/554b9120ee4396259c6d22107b2eaa1ee3a2b36c))
|
|
38
|
+
* Display only one button to copy link in desktop ([8ef090b](https://github.com/cozy/cozy-libs/commit/8ef090b91ab13f747b2190212006254686756d13))
|
|
39
|
+
* Display owner recipient everytime in WhoHasAccess list ([f680913](https://github.com/cozy/cozy-libs/commit/f6809138eff78d6c5a617840914387fea7d59b8e))
|
|
40
|
+
* Display share by email buttons only when recipients not empty ([139b6ad](https://github.com/cozy/cozy-libs/commit/139b6ad8fc0735565e7c5897bc8be1ff4c723c6b))
|
|
41
|
+
* Display sharing link in WhoHasAccess ([8eaa8ee](https://github.com/cozy/cozy-libs/commit/8eaa8ee5b313195e6334b920d0f349d381cb4827))
|
|
42
|
+
* Fade in recipient when link created or recipient added ([d6d84b0](https://github.com/cozy/cozy-libs/commit/d6d84b0c4c5b10243cb08760e6c6e5bf1bec17f1))
|
|
43
|
+
* Hide ShareByEmail controls when input not focused or empty ([7feb150](https://github.com/cozy/cozy-libs/commit/7feb1502ca755b7cea5df252f3333d327f8f1d2f))
|
|
44
|
+
* Improve spacing between Who has access title and components ([14d4619](https://github.com/cozy/cozy-libs/commit/14d46196435f1b96401317f903a8e74a27467372))
|
|
45
|
+
* Link icon in a circle in WhoHasAccess ([513efff](https://github.com/cozy/cozy-libs/commit/513efff434676dd3350797f80b56ad70bbcd5568))
|
|
46
|
+
* Modify share by link creation and edit ([56b2bb4](https://github.com/cozy/cozy-libs/commit/56b2bb465a42db4c4bda076d01375988d01db245))
|
|
47
|
+
* Prevent apps with only read only link to create read write link ([94094dd](https://github.com/cozy/cozy-libs/commit/94094ddc6afabf99dbc2ad231d23e430a1698756))
|
|
48
|
+
* Propose in autosuggest unknown email ([85ad899](https://github.com/cozy/cozy-libs/commit/85ad899cc4ce0d5611cc526a238878ba0f24c87c))
|
|
49
|
+
* Remove ShareByEmail label and update placeholder ([772dc5c](https://github.com/cozy/cozy-libs/commit/772dc5c2e04b090ce0fcf0f275aa1eba0c216eb4))
|
|
50
|
+
* **ShareAutosuggest:** Add Chip and keyboard delete mechanism ([b6edd71](https://github.com/cozy/cozy-libs/commit/b6edd713b925be2b3ea430c34bfe1012ae8b6751))
|
|
51
|
+
* Update and lowercase text in RecipientPermissions ([073c600](https://github.com/cozy/cozy-libs/commit/073c600affe7f6e5fcceefb69b4e34eb79f2fc17))
|
|
52
|
+
* Update cozy-client and cozy-ui ([6ae3b04](https://github.com/cozy/cozy-libs/commit/6ae3b04925ae64fa30f3ec8b6e716453d0a630fe))
|
|
53
|
+
* Update react-autosuggest package ([92abd2c](https://github.com/cozy/cozy-libs/commit/92abd2c87d809b71e7e229d5abde1d0aa4b629a0))
|
|
54
|
+
* Update wording when modifying file or folder ([e9e12aa](https://github.com/cozy/cozy-libs/commit/e9e12aaa4593bf11fada3cf83931d86e8abe0987))
|
|
55
|
+
* Use List instead of CompositeRow for WhoHasAccess ([d9f7cc6](https://github.com/cozy/cozy-libs/commit/d9f7cc6610255b9b4ce202428c4777320dfba7a7))
|
|
56
|
+
* Use navigator.share in mobile to share link ([9da57c6](https://github.com/cozy/cozy-libs/commit/9da57c65e91c43df1b5f2a4c1546c5461eaf057a))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### BREAKING CHANGES
|
|
60
|
+
|
|
61
|
+
* If you imported component directly from
|
|
62
|
+
'cozy-sharing/dist/components/... '
|
|
63
|
+
especially from ' 'cozy-sharing/dist/components/Recipient',
|
|
64
|
+
you will need to update your import.
|
|
65
|
+
|
|
66
|
+
Drive example (the only one I found) :
|
|
67
|
+
`import { RecipientsAvatars } from 'cozy-sharing/dist/components/Recipient'`
|
|
68
|
+
=>
|
|
69
|
+
`import RecipientsAvatars from 'cozy-sharing/dist/components/Recipient/RecipientsAvatars'`
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# 5.0.0 (2023-01-09)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Bug Fixes
|
|
79
|
+
|
|
80
|
+
* Color for badge with me ([bd7def0](https://github.com/cozy/cozy-libs/commit/bd7def03e0db9d8771a1e96965684d8785f6c91b))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Features
|
|
84
|
+
|
|
85
|
+
* **harvest:** Update router packages ([3f08dd2](https://github.com/cozy/cozy-libs/commit/3f08dd2a99fb516c45ff938ca528dece63d10ca3))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### BREAKING CHANGES
|
|
89
|
+
|
|
90
|
+
* **harvest:** `react-router-dom` is `>=4` as peer dependencies.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
6
96
|
# [4.9.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.8.2...cozy-sharing@4.9.0) (2022-12-20)
|
|
7
97
|
|
|
8
98
|
|
package/dist/SharedRecipients.js
CHANGED
|
@@ -4,7 +4,7 @@ var _excluded = ["docId", "onClick"];
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import SharingContext from './context';
|
|
6
6
|
import withLocales from './withLocales';
|
|
7
|
-
import
|
|
7
|
+
import RecipientsAvatars from './components/Recipient/RecipientsAvatars';
|
|
8
8
|
export var SharedRecipients = withLocales(function (_ref) {
|
|
9
9
|
var docId = _ref.docId,
|
|
10
10
|
onClick = _ref.onClick,
|
package/dist/SharedStatus.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SharingContext from './context';
|
|
3
3
|
import withLocales from './withLocales';
|
|
4
|
-
import
|
|
4
|
+
import RecipientsAvatars from './components/Recipient/RecipientsAvatars';
|
|
5
5
|
export var SharedStatus = withLocales(function (_ref) {
|
|
6
6
|
var docId = _ref.docId,
|
|
7
7
|
className = _ref.className,
|
|
@@ -5,7 +5,7 @@ import { useState, useEffect } from 'react';
|
|
|
5
5
|
import { useClient, models } from 'cozy-client';
|
|
6
6
|
import getQueryParameter from '../helpers/QueryParameter';
|
|
7
7
|
import logger from '../../logger';
|
|
8
|
-
import { buildSharingsByIdQuery } from '
|
|
8
|
+
import { buildSharingsByIdQuery } from '../../queries/queries';
|
|
9
9
|
|
|
10
10
|
var getSharingId = function getSharingId(permission) {
|
|
11
11
|
var sourceId = permission.data.attributes.source_id;
|
|
@@ -30,7 +30,7 @@ import PropTypes from 'prop-types';
|
|
|
30
30
|
import { useI18n } from 'cozy-ui/transpiled/react/I18n';
|
|
31
31
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
32
32
|
import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider';
|
|
33
|
-
import
|
|
33
|
+
import OwnerIdentity from './components/Recipient/OwnerIdentity';
|
|
34
34
|
import WhoHasAccess from './components/WhoHasAccess';
|
|
35
35
|
import { getDisplayName } from './models';
|
|
36
36
|
export var SharingDetailsModal = function SharingDetailsModal(_ref) {
|
|
@@ -4,7 +4,7 @@ var _excluded = ["docId"];
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import SharingContext from './context';
|
|
6
6
|
import withLocales from './withLocales';
|
|
7
|
-
import
|
|
7
|
+
import RecipientAvatar from './components/Recipient/RecipientAvatar';
|
|
8
8
|
export var SharingOwnerAvatar = withLocales(function (_ref) {
|
|
9
9
|
var docId = _ref.docId,
|
|
10
10
|
rest = _objectWithoutProperties(_ref, _excluded);
|
package/dist/SharingProvider.js
CHANGED
|
@@ -24,7 +24,9 @@ import SharingContext from './context';
|
|
|
24
24
|
import reducer, { receiveSharings, addSharing, updateSharing, addSharingLink, updateSharingLink, revokeSharingLink, revokeRecipient, revokeSelf, receivePaths, isOwner as _isOwner, canReshare as _canReshare, getOwner as _getOwner, getRecipients as _getRecipients, getSharingById, getSharingDocIds, getSharingForSelf as _getSharingForSelf, getSharingType as _getSharingType, getSharingLink as _getSharingLink, getSharedDocIdsBySharings, getDocumentSharing, getDocumentPermissions as _getDocumentPermissions, hasSharedParent as _hasSharedParent, hasSharedChild as _hasSharedChild } from './state';
|
|
25
25
|
import { fetchNextPermissions } from './fetchNextPermissions';
|
|
26
26
|
import { fetchFilesPaths } from './helpers/files';
|
|
27
|
+
import { SynchronousJobQueue } from './helpers/synchronousJobQueue';
|
|
27
28
|
import { getSharingObject, createSharingInStore, updateSharingInStore } from './helpers/sharings';
|
|
29
|
+
import { fetchApps } from './queries/queries';
|
|
28
30
|
var SHARING_DOCTYPE = 'io.cozy.sharings';
|
|
29
31
|
var PERMISSION_DOCTYPE = 'io.cozy.permissions';
|
|
30
32
|
export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
@@ -81,7 +83,17 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
81
83
|
updateSharingInStore(_this.dispatch, newSharing);
|
|
82
84
|
} else {
|
|
83
85
|
docsId = getSharingDocIds(newSharing);
|
|
84
|
-
|
|
86
|
+
|
|
87
|
+
_this.synchronousJobQueue.push({
|
|
88
|
+
function: createSharingInStore,
|
|
89
|
+
arguments: {
|
|
90
|
+
client: client,
|
|
91
|
+
doctype: doctype,
|
|
92
|
+
dispatch: _this.dispatch,
|
|
93
|
+
docsId: docsId,
|
|
94
|
+
sharing: newSharing
|
|
95
|
+
}
|
|
96
|
+
});
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
case 4:
|
|
@@ -376,14 +388,14 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
376
388
|
}());
|
|
377
389
|
|
|
378
390
|
_defineProperty(_assertThisInitialized(_this), "shareByLink", /*#__PURE__*/function () {
|
|
379
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(document) {
|
|
391
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(document, options) {
|
|
380
392
|
var resp;
|
|
381
393
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
382
394
|
while (1) {
|
|
383
395
|
switch (_context8.prev = _context8.next) {
|
|
384
396
|
case 0:
|
|
385
397
|
_context8.next = 2;
|
|
386
|
-
return _this.permissionCol.createSharingLink(document);
|
|
398
|
+
return _this.permissionCol.createSharingLink(document, options);
|
|
387
399
|
|
|
388
400
|
case 2:
|
|
389
401
|
resp = _context8.sent;
|
|
@@ -400,7 +412,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
400
412
|
}, _callee8);
|
|
401
413
|
}));
|
|
402
414
|
|
|
403
|
-
return function (_x11) {
|
|
415
|
+
return function (_x11, _x12) {
|
|
404
416
|
return _ref10.apply(this, arguments);
|
|
405
417
|
};
|
|
406
418
|
}());
|
|
@@ -443,7 +455,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
443
455
|
}, _callee9);
|
|
444
456
|
}));
|
|
445
457
|
|
|
446
|
-
return function (
|
|
458
|
+
return function (_x15) {
|
|
447
459
|
return _ref12.apply(this, arguments);
|
|
448
460
|
};
|
|
449
461
|
}()));
|
|
@@ -460,7 +472,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
460
472
|
}, _callee10);
|
|
461
473
|
}));
|
|
462
474
|
|
|
463
|
-
return function (
|
|
475
|
+
return function (_x13, _x14) {
|
|
464
476
|
return _ref11.apply(this, arguments);
|
|
465
477
|
};
|
|
466
478
|
}());
|
|
@@ -491,7 +503,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
491
503
|
}, _callee11);
|
|
492
504
|
}));
|
|
493
505
|
|
|
494
|
-
return function (
|
|
506
|
+
return function (_x16) {
|
|
495
507
|
return _ref13.apply(this, arguments);
|
|
496
508
|
};
|
|
497
509
|
}());
|
|
@@ -558,6 +570,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
558
570
|
};
|
|
559
571
|
_this.realtime = null;
|
|
560
572
|
_this.isInitialized = false;
|
|
573
|
+
_this.synchronousJobQueue = new SynchronousJobQueue();
|
|
561
574
|
var _client = props.client;
|
|
562
575
|
_this.sharingCol = _client.collection(SHARING_DOCTYPE);
|
|
563
576
|
_this.permissionCol = _client.collection(PERMISSION_DOCTYPE);
|
|
@@ -596,7 +609,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
596
609
|
case 0:
|
|
597
610
|
_this$props5 = this.props, doctype = _this$props5.doctype, client = _this$props5.client;
|
|
598
611
|
_context12.next = 3;
|
|
599
|
-
return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype),
|
|
612
|
+
return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype), client.query(fetchApps().definition, fetchApps().options)]);
|
|
600
613
|
|
|
601
614
|
case 3:
|
|
602
615
|
_yield$Promise$all = _context12.sent;
|
|
@@ -2,29 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
4
|
import { models } from 'cozy-client';
|
|
5
|
-
var ContactModel = models.contact;
|
|
6
5
|
import { useI18n } from 'cozy-ui/transpiled/react/I18n';
|
|
7
6
|
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"recipient": "recipient__recipient___2FlkK",
|
|
12
|
-
"recipients-list-light": "recipient__recipients-list-light___1Rt5q",
|
|
13
|
-
"recipient-idents": "recipient__recipient-idents___3-fjp",
|
|
14
|
-
"recipient-status-icon": "recipient__recipient-status-icon___J4sIm",
|
|
15
|
-
"recipient-user": "recipient__recipient-user___2cNHW",
|
|
16
|
-
"recipient-details": "recipient__recipient-details___4SMW5",
|
|
17
|
-
"avatar": "recipient__avatar___pPmxN",
|
|
18
|
-
"recipients-avatars": "recipient__recipients-avatars___2Qth2",
|
|
19
|
-
"--interactive": "recipient__--interactive___1V89N",
|
|
20
|
-
"recipients-avatars--link": "recipient__recipients-avatars--link___12LyR",
|
|
21
|
-
"recipients-avatars--plusX": "recipient__recipients-avatars--plusX___28dFs",
|
|
22
|
-
"recipients-avatars--avatar": "recipient__recipients-avatars--avatar___15hBo",
|
|
23
|
-
"spin": "recipient__spin___2cogO",
|
|
24
|
-
"shake": "recipient__shake___3lxk5"
|
|
25
|
-
};
|
|
7
|
+
import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem';
|
|
8
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemIcon';
|
|
9
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
26
10
|
import { Contact, Group, getDisplayName, getInitials } from '../models';
|
|
27
|
-
|
|
11
|
+
var ContactModel = models.contact;
|
|
28
12
|
export var ContactSuggestion = function ContactSuggestion(_ref) {
|
|
29
13
|
var contactOrGroup = _ref.contactOrGroup,
|
|
30
14
|
contacts = _ref.contacts;
|
|
@@ -55,18 +39,22 @@ export var ContactSuggestion = function ContactSuggestion(_ref) {
|
|
|
55
39
|
details = ContactModel.getPrimaryCozy(contactOrGroup);
|
|
56
40
|
}
|
|
57
41
|
|
|
58
|
-
return /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
42
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
43
|
+
button: true
|
|
44
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
61
45
|
text: avatarText,
|
|
62
46
|
size: "small"
|
|
63
|
-
}), /*#__PURE__*/React.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
48
|
+
primary: name,
|
|
49
|
+
secondary: details && details !== '' ? details : '-'
|
|
66
50
|
}));
|
|
67
51
|
};
|
|
52
|
+
var newUnknownContactProptypes = PropTypes.shape({
|
|
53
|
+
_type: PropTypes.string.isRequired,
|
|
54
|
+
email: PropTypes.string.isRequired
|
|
55
|
+
});
|
|
68
56
|
ContactSuggestion.propTypes = {
|
|
69
|
-
contactOrGroup: PropTypes.oneOfType([Contact.propType, Group.propType]).isRequired,
|
|
57
|
+
contactOrGroup: PropTypes.oneOfType([Contact.propType, Group.propType, newUnknownContactProptypes]).isRequired,
|
|
70
58
|
contacts: PropTypes.arrayOf(Contact.propType)
|
|
71
59
|
};
|
|
72
60
|
export default ContactSuggestion;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useI18n } from 'cozy-ui/transpiled/react/I18n';
|
|
5
|
+
import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
6
|
+
import Button from 'cozy-ui/transpiled/react/Buttons';
|
|
7
|
+
import Radio from 'cozy-ui/transpiled/react/Radios';
|
|
8
|
+
import RadioGroup from 'cozy-ui/transpiled/react/RadioGroup';
|
|
9
|
+
import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel';
|
|
10
|
+
|
|
11
|
+
var EditLinkPermissionDialog = function EditLinkPermissionDialog(_ref) {
|
|
12
|
+
var open = _ref.open,
|
|
13
|
+
onClose = _ref.onClose,
|
|
14
|
+
document = _ref.document,
|
|
15
|
+
onPermissionsSelected = _ref.onPermissionsSelected;
|
|
16
|
+
|
|
17
|
+
var _useI18n = useI18n(),
|
|
18
|
+
t = _useI18n.t;
|
|
19
|
+
|
|
20
|
+
var _useState = useState(true),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
isReadOnlyPermissions = _useState2[0],
|
|
23
|
+
setIsReadOnlyPermissions = _useState2[1];
|
|
24
|
+
|
|
25
|
+
var onChange = function onChange(event) {
|
|
26
|
+
setIsReadOnlyPermissions(event.target.value === 'true');
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var onConfirm = function onConfirm() {
|
|
30
|
+
var verbs = isReadOnlyPermissions ? ['GET'] : ['GET', 'POST', 'PUT', 'PATCH'];
|
|
31
|
+
onPermissionsSelected({
|
|
32
|
+
verbs: verbs
|
|
33
|
+
});
|
|
34
|
+
onClose();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
38
|
+
open: open,
|
|
39
|
+
onClose: onClose,
|
|
40
|
+
title: t('Share.permissionLink.title'),
|
|
41
|
+
content: /*#__PURE__*/React.createElement(RadioGroup, {
|
|
42
|
+
"aria-label": "radio",
|
|
43
|
+
value: isReadOnlyPermissions.toString(),
|
|
44
|
+
onChange: onChange
|
|
45
|
+
}, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
46
|
+
value: "true",
|
|
47
|
+
label: (document === null || document === void 0 ? void 0 : document.type) === 'directory' ? t("Share.permissionLink.seeFolder") : t("Share.permissionLink.seeFile"),
|
|
48
|
+
control: /*#__PURE__*/React.createElement(Radio, null)
|
|
49
|
+
}), /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
50
|
+
value: "false",
|
|
51
|
+
label: (document === null || document === void 0 ? void 0 : document.type) === 'directory' ? t("Share.permissionLink.modifyFolder") : t("Share.permissionLink.modifyFile"),
|
|
52
|
+
control: /*#__PURE__*/React.createElement(Radio, null)
|
|
53
|
+
})),
|
|
54
|
+
actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
55
|
+
variant: "secondary",
|
|
56
|
+
label: t('Share.permissionLink.cancel'),
|
|
57
|
+
onClick: onClose
|
|
58
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
variant: "primary",
|
|
60
|
+
label: t('Share.permissionLink.confirm'),
|
|
61
|
+
onClick: onConfirm
|
|
62
|
+
}))
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
EditLinkPermissionDialog.propTypes = {
|
|
67
|
+
open: PropTypes.bool.isRequired,
|
|
68
|
+
onClose: PropTypes.func.isRequired,
|
|
69
|
+
document: PropTypes.object.isRequired,
|
|
70
|
+
onPermissionsSelected: PropTypes.func.isRequired
|
|
71
|
+
};
|
|
72
|
+
export default EditLinkPermissionDialog;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
4
|
+
import { createMockClient } from 'cozy-client';
|
|
5
|
+
import AppLike from '../../test/AppLike';
|
|
6
|
+
import EditLinkPermissionDialog from './EditLinkPermissionDialog';
|
|
7
|
+
describe('EditLinkPermissionDialog', function () {
|
|
8
|
+
var client = createMockClient({});
|
|
9
|
+
|
|
10
|
+
var setup = function setup(props) {
|
|
11
|
+
return render( /*#__PURE__*/React.createElement(AppLike, {
|
|
12
|
+
client: client
|
|
13
|
+
}, /*#__PURE__*/React.createElement(EditLinkPermissionDialog, _extends({
|
|
14
|
+
open: true,
|
|
15
|
+
onClose: function onClose() {}
|
|
16
|
+
}, props))));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
it('should select read permissions', function () {
|
|
20
|
+
var onPermissionsSelected = jest.fn();
|
|
21
|
+
var props = {
|
|
22
|
+
onPermissionsSelected: onPermissionsSelected
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var _setup = setup(props),
|
|
26
|
+
getByText = _setup.getByText;
|
|
27
|
+
|
|
28
|
+
fireEvent.click(getByText('OK'));
|
|
29
|
+
expect(onPermissionsSelected).toHaveBeenCalledWith({
|
|
30
|
+
verbs: ['GET']
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
it('should select write permissions', function () {
|
|
34
|
+
var onPermissionsSelected = jest.fn();
|
|
35
|
+
var props = {
|
|
36
|
+
onPermissionsSelected: onPermissionsSelected
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var _setup2 = setup(props),
|
|
40
|
+
getByText = _setup2.getByText;
|
|
41
|
+
|
|
42
|
+
fireEvent.click(getByText('Modify file'));
|
|
43
|
+
fireEvent.click(getByText('OK'));
|
|
44
|
+
expect(onPermissionsSelected).toHaveBeenCalledWith({
|
|
45
|
+
verbs: ['GET', 'POST', 'PUT', 'PATCH']
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["
|
|
3
|
+
var _excluded = ["document"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import { Contact
|
|
8
|
-
import { contactsResponseType, groupsResponseType } from '../propTypes';
|
|
6
|
+
import { useClient, useQueryAll } from 'cozy-client';
|
|
7
|
+
import { Contact } from '../models';
|
|
9
8
|
import SharingContext from '../context';
|
|
10
|
-
import ContactsAndGroupsDataLoader from './ContactsAndGroupsDataLoader';
|
|
11
9
|
import { default as DumbShareModal } from './ShareModal';
|
|
12
10
|
import { useFetchDocumentPath } from './useFetchDocumentPath';
|
|
11
|
+
import { buildContactsQuery, buildGroupsQuery } from '../queries/queries';
|
|
13
12
|
export var EditableSharingModal = function EditableSharingModal(_ref) {
|
|
14
|
-
var
|
|
15
|
-
document = _ref.document,
|
|
16
|
-
groups = _ref.groups,
|
|
13
|
+
var document = _ref.document,
|
|
17
14
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
18
15
|
|
|
19
16
|
var client = useClient();
|
|
20
17
|
var documentPath = useFetchDocumentPath(client, document);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
var contactsQuery = buildContactsQuery();
|
|
19
|
+
var contactsResult = useQueryAll(contactsQuery.definition, contactsQuery.options);
|
|
20
|
+
var groupsQuery = buildGroupsQuery();
|
|
21
|
+
var groupsResult = useQueryAll(groupsQuery.definition, groupsQuery.options);
|
|
22
|
+
return /*#__PURE__*/React.createElement(SharingContext.Consumer, null, function (_ref2) {
|
|
25
23
|
var documentType = _ref2.documentType,
|
|
26
24
|
getDocumentPermissions = _ref2.getDocumentPermissions,
|
|
27
25
|
getRecipients = _ref2.getRecipients,
|
|
@@ -37,13 +35,13 @@ export var EditableSharingModal = function EditableSharingModal(_ref) {
|
|
|
37
35
|
shareByLink = _ref2.shareByLink,
|
|
38
36
|
updateDocumentPermissions = _ref2.updateDocumentPermissions;
|
|
39
37
|
return /*#__PURE__*/React.createElement(DumbShareModal, _extends({
|
|
40
|
-
contacts:
|
|
38
|
+
contacts: contactsResult,
|
|
41
39
|
createContact: function createContact(contact) {
|
|
42
40
|
return client.create(Contact.doctype, contact);
|
|
43
41
|
},
|
|
44
42
|
document: document,
|
|
45
43
|
documentType: documentType,
|
|
46
|
-
groups:
|
|
44
|
+
groups: groupsResult,
|
|
47
45
|
hasSharedChild: documentPath && hasSharedChild(documentPath),
|
|
48
46
|
hasSharedParent: documentPath && hasSharedParent(documentPath),
|
|
49
47
|
isOwner: isOwner(document.id),
|
|
@@ -58,54 +56,9 @@ export var EditableSharingModal = function EditableSharingModal(_ref) {
|
|
|
58
56
|
recipients: getRecipients(document.id),
|
|
59
57
|
sharing: getSharingForSelf(document.id)
|
|
60
58
|
}, rest));
|
|
61
|
-
})
|
|
59
|
+
});
|
|
62
60
|
};
|
|
63
61
|
EditableSharingModal.propTypes = {
|
|
64
|
-
|
|
65
|
-
document: PropTypes.object,
|
|
66
|
-
groups: groupsResponseType
|
|
62
|
+
document: PropTypes.object
|
|
67
63
|
};
|
|
68
|
-
|
|
69
|
-
var contactsQuery = function contactsQuery() {
|
|
70
|
-
return Q(Contact.doctype).where({
|
|
71
|
-
_id: {
|
|
72
|
-
$gt: null
|
|
73
|
-
}
|
|
74
|
-
}).partialIndex({
|
|
75
|
-
trashed: {
|
|
76
|
-
$or: [{
|
|
77
|
-
$eq: false
|
|
78
|
-
}, {
|
|
79
|
-
$exists: false
|
|
80
|
-
}]
|
|
81
|
-
},
|
|
82
|
-
$or: [{
|
|
83
|
-
cozy: {
|
|
84
|
-
$not: {
|
|
85
|
-
$size: 0
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
email: {
|
|
90
|
-
$not: {
|
|
91
|
-
$size: 0
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}]
|
|
95
|
-
}).indexFields(['_id']).limitBy(1000);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
var groupsQuery = function groupsQuery() {
|
|
99
|
-
return Q(Group.doctype);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export default queryConnect({
|
|
103
|
-
contacts: {
|
|
104
|
-
query: contactsQuery,
|
|
105
|
-
as: 'contacts'
|
|
106
|
-
},
|
|
107
|
-
groups: {
|
|
108
|
-
query: groupsQuery,
|
|
109
|
-
as: 'groups'
|
|
110
|
-
}
|
|
111
|
-
})(EditableSharingModal);
|
|
64
|
+
export default EditableSharingModal;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import uniqueId from 'lodash/uniqueId';
|
|
4
4
|
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
5
|
-
import { SharingTooltip, TooltipRecipientList } from '
|
|
5
|
+
import { SharingTooltip, TooltipRecipientList } from '../Tooltip';
|
|
6
6
|
|
|
7
7
|
var AvatarPlusX = function AvatarPlusX(_ref) {
|
|
8
8
|
var className = _ref.className,
|
|
@@ -2,22 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
var styles = {
|
|
5
|
-
"CozyTheme--inverted": "recipient__CozyTheme--
|
|
6
|
-
"CozyTheme--normal": "recipient__CozyTheme--
|
|
7
|
-
"recipient": "
|
|
8
|
-
"recipients-list-light": "recipient__recipients-list-
|
|
9
|
-
"recipient-idents": "recipient__recipient-
|
|
10
|
-
"recipient-status-icon": "recipient__recipient-status-
|
|
11
|
-
"recipient-user": "recipient__recipient-
|
|
12
|
-
"recipient-details": "recipient__recipient-
|
|
13
|
-
"avatar": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"recipients-avatars--
|
|
18
|
-
"recipients-avatars--
|
|
19
|
-
"
|
|
20
|
-
"
|
|
5
|
+
"CozyTheme--inverted": "recipient__CozyTheme--inverted___2Hb9c",
|
|
6
|
+
"CozyTheme--normal": "recipient__CozyTheme--normal___3WdEw",
|
|
7
|
+
"recipient": "recipient__recipient___2zWmH",
|
|
8
|
+
"recipients-list-light": "recipient__recipients-list-light___1-dkI",
|
|
9
|
+
"recipient-idents": "recipient__recipient-idents___3F3zL",
|
|
10
|
+
"recipient-status-icon": "recipient__recipient-status-icon___1GvS9",
|
|
11
|
+
"recipient-user": "recipient__recipient-user___3hOyK",
|
|
12
|
+
"recipient-details": "recipient__recipient-details___3fmFE",
|
|
13
|
+
"avatar": "recipient__avatar___2NIEb",
|
|
14
|
+
"link-recipient-icon-circle": "recipient__link-recipient-icon-circle___3gmgy",
|
|
15
|
+
"recipients-avatars": "recipient__recipients-avatars___MXhiL",
|
|
16
|
+
"--interactive": "recipient__--interactive___1gDjM",
|
|
17
|
+
"recipients-avatars--link": "recipient__recipients-avatars--link___2s02h",
|
|
18
|
+
"recipients-avatars--plusX": "recipient__recipients-avatars--plusX___WRllr",
|
|
19
|
+
"recipients-avatars--avatar": "recipient__recipients-avatars--avatar___3j3_A",
|
|
20
|
+
"spin": "recipient__spin___3_Uja",
|
|
21
|
+
"shake": "recipient__shake___TrWC0"
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
var Identity = function Identity(_ref) {
|