cozy-sharing 11.1.0 → 12.1.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/.storybook/preview.jsx +11 -5
- package/CHANGELOG.md +29 -0
- package/dist/SharingProvider.js +111 -62
- package/dist/components/ConfirmTrustedRecipientsDialog.js +11 -3
- package/dist/components/ConfirmTrustedRecipientsDialog.stories.js +39 -0
- package/dist/components/Recipient/GroupRecipient.js +36 -5
- package/dist/components/Recipient/GroupRecipient.stories.js +3 -2
- package/dist/components/Recipient/GroupRecipientDetail.js +43 -0
- package/dist/components/Recipient/GroupRecipientDetail.stories.js +55 -0
- package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +44 -0
- package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +45 -0
- package/dist/components/Recipient/GroupRecipientPermissions.js +70 -8
- package/dist/components/Recipient/LinkRecipient.js +5 -1
- package/dist/components/Recipient/MemberRecipient.js +5 -1
- package/dist/components/Recipient/RecipientList.stories.js +3 -0
- package/dist/components/Recipient/actions/permission.js +4 -7
- package/dist/components/ShareDialogCozyToCozy.js +9 -3
- package/dist/components/ShareDialogOnlyByLink.js +12 -4
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -0
- package/dist/components/ShareModal/SharingDetailsModal.js +7 -1
- package/dist/components/WhoHasAccess.js +1 -3
- package/dist/state.js +27 -0
- package/locales/en.json +13 -0
- package/locales/fr.json +13 -0
- package/package.json +5 -5
- package/src/SharingProvider.jsx +15 -0
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +24 -13
- package/src/components/ConfirmTrustedRecipientsDialog.stories.jsx +45 -0
- package/src/components/Recipient/GroupRecipient.jsx +51 -24
- package/src/components/Recipient/GroupRecipient.stories.jsx +3 -2
- package/src/components/Recipient/GroupRecipientDetail.jsx +50 -0
- package/src/components/Recipient/GroupRecipientDetail.stories.jsx +53 -0
- package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +57 -0
- package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +60 -0
- package/src/components/Recipient/GroupRecipientPermissions.jsx +35 -6
- package/src/components/Recipient/LinkRecipient.jsx +3 -1
- package/src/components/Recipient/MemberRecipient.jsx +3 -1
- package/src/components/Recipient/RecipientList.stories.jsx +3 -0
- package/src/components/Recipient/actions/permission.js +3 -6
- package/src/components/ShareDialogCozyToCozy.jsx +40 -36
- package/src/components/ShareDialogOnlyByLink.jsx +22 -8
- package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +1 -0
- package/src/components/ShareModal/SharingDetailsModal.jsx +10 -1
- package/src/components/WhoHasAccess.jsx +1 -1
- package/src/state.js +28 -0
package/.storybook/preview.jsx
CHANGED
|
@@ -10,6 +10,7 @@ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
|
|
|
10
10
|
import { CozyProvider, createFakeClient } from 'cozy-client'
|
|
11
11
|
|
|
12
12
|
import enLocale from '../locales/en.json'
|
|
13
|
+
import SharingContext from "../src/context";
|
|
13
14
|
|
|
14
15
|
const preview = {
|
|
15
16
|
decorators: [
|
|
@@ -40,11 +41,16 @@ const preview = {
|
|
|
40
41
|
<CozyProvider client={fakeClient}>
|
|
41
42
|
<CozyTheme>
|
|
42
43
|
<BreakpointsProvider>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
<SharingContext.Provider value={{
|
|
45
|
+
revokeGroup: () => {},
|
|
46
|
+
revokeSelf: () => {}
|
|
47
|
+
}}>
|
|
48
|
+
<I18n lang="en" dictRequire={() => enLocale}>
|
|
49
|
+
<div style={{position: "relative"}}>
|
|
50
|
+
<Story />
|
|
51
|
+
</div>
|
|
52
|
+
</I18n>
|
|
53
|
+
</SharingContext.Provider>
|
|
48
54
|
</BreakpointsProvider>
|
|
49
55
|
</CozyTheme>
|
|
50
56
|
</CozyProvider>
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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
|
+
# [12.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@12.0.0...cozy-sharing@12.1.0) (2024-03-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Adapt modal design to allow gutters into ListItem ([39dc590](https://github.com/cozy/cozy-libs/commit/39dc5905ee19e07967227e76d376ff04c6145c1e))
|
|
12
|
+
* Show detail of recipient groups ([7d731db](https://github.com/cozy/cozy-libs/commit/7d731db9d313ba763652612352ce393f475bfe5f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [12.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@11.1.0...cozy-sharing@12.0.0) (2024-03-21)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* Making it possible to revoke a group ([cc3e998](https://github.com/cozy/cozy-libs/commit/cc3e998d94450d0698373f217a4eea06d1a81ede))
|
|
24
|
+
* Update cozy-client from 45.14.0 to 46.1.0 ([958c55c](https://github.com/cozy/cozy-libs/commit/958c55c5d55a540d0c5b341b6780cb16b1617ff9))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### BREAKING CHANGES
|
|
28
|
+
|
|
29
|
+
* you must have `cozy-client >=46.1.0`
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
# [11.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@11.0.1...cozy-sharing@11.1.0) (2024-03-21)
|
|
7
36
|
|
|
8
37
|
|
package/dist/SharingProvider.js
CHANGED
|
@@ -39,7 +39,7 @@ import { fetchFilesPaths } from './helpers/files';
|
|
|
39
39
|
import { getSharingObject, createSharingInStore, updateSharingInStore } from './helpers/sharings';
|
|
40
40
|
import { SynchronousJobQueue } from './helpers/synchronousJobQueue';
|
|
41
41
|
import { fetchApps } from './queries/queries';
|
|
42
|
-
import reducer, { receiveSharings, addSharing, updateSharing, addSharingLink, updateSharingLink, revokeSharingLink, revokeRecipient, revokeSelf, receivePaths, isOwner as _isOwner, canReshare as _canReshare, getOwner as _getOwner, getRecipients as _getRecipients, getSharingById, getExternalSharingIds, getSharingForSelf as _getSharingForSelf, getSharingType as _getSharingType, getSharingLink as _getSharingLink, getSharedDocIdsBySharings, getDocumentSharing, getDocumentPermissions as _getDocumentPermissions, hasSharedParent as _hasSharedParent, hasSharedChild as _hasSharedChild, getSharedParentPath as _getSharedParentPath } from './state';
|
|
42
|
+
import reducer, { receiveSharings, addSharing, updateSharing, addSharingLink, updateSharingLink, revokeSharingLink, revokeRecipient, revokeGroup as revokeGroupFromState, revokeSelf, receivePaths, isOwner as _isOwner, canReshare as _canReshare, getOwner as _getOwner, getRecipients as _getRecipients, getSharingById, getExternalSharingIds, getSharingForSelf as _getSharingForSelf, getSharingType as _getSharingType, getSharingLink as _getSharingLink, getSharedDocIdsBySharings, getDocumentSharing, getDocumentPermissions as _getDocumentPermissions, hasSharedParent as _hasSharedParent, hasSharedChild as _hasSharedChild, getSharedParentPath as _getSharedParentPath } from './state';
|
|
43
43
|
var SHARING_DOCTYPE = 'io.cozy.sharings';
|
|
44
44
|
var PERMISSION_DOCTYPE = 'io.cozy.permissions';
|
|
45
45
|
export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
@@ -359,14 +359,62 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
359
359
|
};
|
|
360
360
|
}());
|
|
361
361
|
|
|
362
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
363
|
-
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(document) {
|
|
364
|
-
var sharing;
|
|
362
|
+
_defineProperty(_assertThisInitialized(_this), "revokeGroup", /*#__PURE__*/function () {
|
|
363
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(document, sharingId, recipientIndex) {
|
|
364
|
+
var _this$props5, client, doctype, sharing;
|
|
365
|
+
|
|
365
366
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
366
367
|
while (1) switch (_context7.prev = _context7.next) {
|
|
368
|
+
case 0:
|
|
369
|
+
_this$props5 = _this.props, client = _this$props5.client, doctype = _this$props5.doctype;
|
|
370
|
+
sharing = getSharingById(_this.state, sharingId);
|
|
371
|
+
_context7.next = 4;
|
|
372
|
+
return _this.sharingCol.revokeGroup(sharing, recipientIndex);
|
|
373
|
+
|
|
374
|
+
case 4:
|
|
375
|
+
_context7.t0 = _this;
|
|
376
|
+
_context7.t1 = revokeGroupFromState;
|
|
377
|
+
_context7.t2 = sharing;
|
|
378
|
+
_context7.t3 = recipientIndex;
|
|
379
|
+
_context7.t4 = document.path;
|
|
380
|
+
|
|
381
|
+
if (_context7.t4) {
|
|
382
|
+
_context7.next = 13;
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
_context7.next = 12;
|
|
387
|
+
return fetchFilesPaths(client, doctype, [document]);
|
|
388
|
+
|
|
389
|
+
case 12:
|
|
390
|
+
_context7.t4 = _context7.sent;
|
|
391
|
+
|
|
392
|
+
case 13:
|
|
393
|
+
_context7.t5 = _context7.t4;
|
|
394
|
+
_context7.t6 = (0, _context7.t1)(_context7.t2, _context7.t3, _context7.t5);
|
|
395
|
+
|
|
396
|
+
_context7.t0.dispatch.call(_context7.t0, _context7.t6);
|
|
397
|
+
|
|
398
|
+
case 16:
|
|
399
|
+
case "end":
|
|
400
|
+
return _context7.stop();
|
|
401
|
+
}
|
|
402
|
+
}, _callee7);
|
|
403
|
+
}));
|
|
404
|
+
|
|
405
|
+
return function (_x10, _x11, _x12) {
|
|
406
|
+
return _ref9.apply(this, arguments);
|
|
407
|
+
};
|
|
408
|
+
}());
|
|
409
|
+
|
|
410
|
+
_defineProperty(_assertThisInitialized(_this), "revokeSelf", /*#__PURE__*/function () {
|
|
411
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(document) {
|
|
412
|
+
var sharing;
|
|
413
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
414
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
367
415
|
case 0:
|
|
368
416
|
sharing = _getSharingForSelf(_this.state, document.id);
|
|
369
|
-
|
|
417
|
+
_context8.next = 3;
|
|
370
418
|
return _this.sharingCol.revokeSelf(sharing);
|
|
371
419
|
|
|
372
420
|
case 3:
|
|
@@ -374,41 +422,41 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
374
422
|
|
|
375
423
|
case 4:
|
|
376
424
|
case "end":
|
|
377
|
-
return
|
|
425
|
+
return _context8.stop();
|
|
378
426
|
}
|
|
379
|
-
},
|
|
427
|
+
}, _callee8);
|
|
380
428
|
}));
|
|
381
429
|
|
|
382
|
-
return function (
|
|
383
|
-
return
|
|
430
|
+
return function (_x13) {
|
|
431
|
+
return _ref10.apply(this, arguments);
|
|
384
432
|
};
|
|
385
433
|
}());
|
|
386
434
|
|
|
387
435
|
_defineProperty(_assertThisInitialized(_this), "shareByLink", /*#__PURE__*/function () {
|
|
388
|
-
var
|
|
436
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(document, options) {
|
|
389
437
|
var resp;
|
|
390
|
-
return _regeneratorRuntime.wrap(function
|
|
391
|
-
while (1) switch (
|
|
438
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
439
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
392
440
|
case 0:
|
|
393
|
-
|
|
441
|
+
_context9.next = 2;
|
|
394
442
|
return _this.permissionCol.createSharingLink(document, options);
|
|
395
443
|
|
|
396
444
|
case 2:
|
|
397
|
-
resp =
|
|
445
|
+
resp = _context9.sent;
|
|
398
446
|
|
|
399
447
|
_this.dispatch(addSharingLink(resp.data));
|
|
400
448
|
|
|
401
|
-
return
|
|
449
|
+
return _context9.abrupt("return", resp);
|
|
402
450
|
|
|
403
451
|
case 5:
|
|
404
452
|
case "end":
|
|
405
|
-
return
|
|
453
|
+
return _context9.stop();
|
|
406
454
|
}
|
|
407
|
-
},
|
|
455
|
+
}, _callee9);
|
|
408
456
|
}));
|
|
409
457
|
|
|
410
|
-
return function (
|
|
411
|
-
return
|
|
458
|
+
return function (_x14, _x15) {
|
|
459
|
+
return _ref11.apply(this, arguments);
|
|
412
460
|
};
|
|
413
461
|
}());
|
|
414
462
|
|
|
@@ -421,71 +469,71 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
421
469
|
* @return {Array}
|
|
422
470
|
*/
|
|
423
471
|
_defineProperty(_assertThisInitialized(_this), "updateDocumentPermissions", /*#__PURE__*/function () {
|
|
424
|
-
var
|
|
472
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(document, newVerbs) {
|
|
425
473
|
var permissions, responses;
|
|
426
|
-
return _regeneratorRuntime.wrap(function
|
|
427
|
-
while (1) switch (
|
|
474
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
475
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
428
476
|
case 0:
|
|
429
477
|
permissions = _getDocumentPermissions(_this.state, document.id);
|
|
430
|
-
|
|
478
|
+
_context11.next = 3;
|
|
431
479
|
return Promise.all(permissions.map( /*#__PURE__*/function () {
|
|
432
|
-
var
|
|
480
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(permissionDocument) {
|
|
433
481
|
var updatedPermissions, resp;
|
|
434
|
-
return _regeneratorRuntime.wrap(function
|
|
435
|
-
while (1) switch (
|
|
482
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
483
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
436
484
|
case 0:
|
|
437
485
|
updatedPermissions = permissionDocument.attributes.permissions;
|
|
438
486
|
Object.keys(updatedPermissions).map(function (permType) {
|
|
439
487
|
updatedPermissions[permType].verbs = newVerbs;
|
|
440
488
|
});
|
|
441
|
-
|
|
489
|
+
_context10.next = 4;
|
|
442
490
|
return _this.permissionCol.add(permissionDocument, updatedPermissions);
|
|
443
491
|
|
|
444
492
|
case 4:
|
|
445
|
-
resp =
|
|
493
|
+
resp = _context10.sent;
|
|
446
494
|
|
|
447
495
|
_this.dispatch(updateSharingLink(resp));
|
|
448
496
|
|
|
449
|
-
return
|
|
497
|
+
return _context10.abrupt("return", resp);
|
|
450
498
|
|
|
451
499
|
case 7:
|
|
452
500
|
case "end":
|
|
453
|
-
return
|
|
501
|
+
return _context10.stop();
|
|
454
502
|
}
|
|
455
|
-
},
|
|
503
|
+
}, _callee10);
|
|
456
504
|
}));
|
|
457
505
|
|
|
458
|
-
return function (
|
|
459
|
-
return
|
|
506
|
+
return function (_x18) {
|
|
507
|
+
return _ref13.apply(this, arguments);
|
|
460
508
|
};
|
|
461
509
|
}()));
|
|
462
510
|
|
|
463
511
|
case 3:
|
|
464
|
-
responses =
|
|
465
|
-
return
|
|
512
|
+
responses = _context11.sent;
|
|
513
|
+
return _context11.abrupt("return", responses);
|
|
466
514
|
|
|
467
515
|
case 5:
|
|
468
516
|
case "end":
|
|
469
|
-
return
|
|
517
|
+
return _context11.stop();
|
|
470
518
|
}
|
|
471
|
-
},
|
|
519
|
+
}, _callee11);
|
|
472
520
|
}));
|
|
473
521
|
|
|
474
|
-
return function (
|
|
475
|
-
return
|
|
522
|
+
return function (_x16, _x17) {
|
|
523
|
+
return _ref12.apply(this, arguments);
|
|
476
524
|
};
|
|
477
525
|
}());
|
|
478
526
|
|
|
479
527
|
_defineProperty(_assertThisInitialized(_this), "revokeSharingLink", /*#__PURE__*/function () {
|
|
480
|
-
var
|
|
528
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(document) {
|
|
481
529
|
var perms;
|
|
482
|
-
return _regeneratorRuntime.wrap(function
|
|
483
|
-
while (1) switch (
|
|
530
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
531
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
484
532
|
case 0:
|
|
485
533
|
// Because some duplicate links have been created in the past, we must ensure
|
|
486
534
|
// we revoke all of them
|
|
487
535
|
perms = _getDocumentPermissions(_this.state, document.id);
|
|
488
|
-
|
|
536
|
+
_context12.next = 3;
|
|
489
537
|
return Promise.all(perms.map(function (p) {
|
|
490
538
|
return _this.permissionCol.destroy(p);
|
|
491
539
|
}));
|
|
@@ -495,13 +543,13 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
495
543
|
|
|
496
544
|
case 4:
|
|
497
545
|
case "end":
|
|
498
|
-
return
|
|
546
|
+
return _context12.stop();
|
|
499
547
|
}
|
|
500
|
-
},
|
|
548
|
+
}, _callee12);
|
|
501
549
|
}));
|
|
502
550
|
|
|
503
|
-
return function (
|
|
504
|
-
return
|
|
551
|
+
return function (_x19) {
|
|
552
|
+
return _ref14.apply(this, arguments);
|
|
505
553
|
};
|
|
506
554
|
}());
|
|
507
555
|
|
|
@@ -558,6 +606,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
558
606
|
share: _this.share,
|
|
559
607
|
onShared: onShared,
|
|
560
608
|
revoke: _this.revoke,
|
|
609
|
+
revokeGroup: _this.revokeGroup,
|
|
561
610
|
revokeSelf: _this.revokeSelf,
|
|
562
611
|
shareByLink: _this.shareByLink,
|
|
563
612
|
updateDocumentPermissions: _this.updateDocumentPermissions,
|
|
@@ -600,18 +649,18 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
600
649
|
}, {
|
|
601
650
|
key: "fetchAllSharings",
|
|
602
651
|
value: function () {
|
|
603
|
-
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
604
|
-
var _this$
|
|
652
|
+
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
653
|
+
var _this$props6, doctype, client, _yield$Promise$all, _yield$Promise$all2, sharings, permissions, apps, sharedDocIds, resp, folderPaths, filePaths;
|
|
605
654
|
|
|
606
|
-
return _regeneratorRuntime.wrap(function
|
|
607
|
-
while (1) switch (
|
|
655
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
656
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
608
657
|
case 0:
|
|
609
|
-
_this$
|
|
610
|
-
|
|
658
|
+
_this$props6 = this.props, doctype = _this$props6.doctype, client = _this$props6.client;
|
|
659
|
+
_context13.next = 3;
|
|
611
660
|
return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype), client.fetchQueryAndGetFromState(fetchApps())]);
|
|
612
661
|
|
|
613
662
|
case 3:
|
|
614
|
-
_yield$Promise$all =
|
|
663
|
+
_yield$Promise$all = _context13.sent;
|
|
615
664
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
616
665
|
sharings = _yield$Promise$all2[0];
|
|
617
666
|
permissions = _yield$Promise$all2[1];
|
|
@@ -626,35 +675,35 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
626
675
|
hasLoadedAtLeastOnePage: true
|
|
627
676
|
}); // eslint-disable-next-line promise/catch-or-return
|
|
628
677
|
|
|
629
|
-
|
|
678
|
+
_context13.next = 12;
|
|
630
679
|
return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
|
|
631
680
|
|
|
632
681
|
case 12:
|
|
633
682
|
if (!(doctype === 'io.cozy.files')) {
|
|
634
|
-
|
|
683
|
+
_context13.next = 22;
|
|
635
684
|
break;
|
|
636
685
|
}
|
|
637
686
|
|
|
638
687
|
sharedDocIds = getSharedDocIdsBySharings(sharings);
|
|
639
|
-
|
|
688
|
+
_context13.next = 16;
|
|
640
689
|
return client.collection(doctype).all({
|
|
641
690
|
keys: sharedDocIds
|
|
642
691
|
});
|
|
643
692
|
|
|
644
693
|
case 16:
|
|
645
|
-
resp =
|
|
694
|
+
resp = _context13.sent;
|
|
646
695
|
folderPaths = resp.data.filter(function (f) {
|
|
647
696
|
return f.type === 'directory' && !f.trashed;
|
|
648
697
|
}).map(function (f) {
|
|
649
698
|
return f.path;
|
|
650
699
|
});
|
|
651
|
-
|
|
700
|
+
_context13.next = 20;
|
|
652
701
|
return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
|
|
653
702
|
return f.type !== 'directory' && !f.trashed;
|
|
654
703
|
}));
|
|
655
704
|
|
|
656
705
|
case 20:
|
|
657
|
-
filePaths =
|
|
706
|
+
filePaths = _context13.sent;
|
|
658
707
|
this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
|
|
659
708
|
|
|
660
709
|
case 22:
|
|
@@ -664,9 +713,9 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
664
713
|
|
|
665
714
|
case 23:
|
|
666
715
|
case "end":
|
|
667
|
-
return
|
|
716
|
+
return _context13.stop();
|
|
668
717
|
}
|
|
669
|
-
},
|
|
718
|
+
}, _callee13, this);
|
|
670
719
|
}));
|
|
671
720
|
|
|
672
721
|
function fetchAllSharings() {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import cx from 'classnames';
|
|
3
4
|
import React from 'react';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
4
6
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
7
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
5
8
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
6
9
|
import MemberRecipient from './Recipient/MemberRecipient';
|
|
7
10
|
import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
|
|
@@ -16,17 +19,22 @@ var SharingContent = function SharingContent(_ref) {
|
|
|
16
19
|
var _useI18n = useI18n(),
|
|
17
20
|
t = _useI18n.t;
|
|
18
21
|
|
|
22
|
+
var _useBreakpoints = useBreakpoints(),
|
|
23
|
+
isMobile = _useBreakpoints.isMobile;
|
|
24
|
+
|
|
19
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
26
|
variant: "body1",
|
|
21
|
-
className:
|
|
22
|
-
}, t("ConfirmRecipientModal.intruction")),
|
|
27
|
+
className: cx('u-mb-half', isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')
|
|
28
|
+
}, t("ConfirmRecipientModal.intruction")), /*#__PURE__*/React.createElement(List, {
|
|
29
|
+
className: isMobile ? 'u-mb-half' : 'u-mb-1'
|
|
30
|
+
}, recipientsToBeConfirmed.map(function (recipientConfirmationData) {
|
|
23
31
|
return /*#__PURE__*/React.createElement(MemberRecipient, _extends({}, recipientConfirmationData, {
|
|
24
32
|
key: "key_r_".concat(recipientConfirmationData.id),
|
|
25
33
|
isOwner: false,
|
|
26
34
|
recipientConfirmationData: recipientConfirmationData,
|
|
27
35
|
verifyRecipient: verifyRecipient
|
|
28
36
|
}));
|
|
29
|
-
}));
|
|
37
|
+
})));
|
|
30
38
|
};
|
|
31
39
|
/**
|
|
32
40
|
* Displays the dialog's title that can be used when ConfirmTrustedRecipientsDialog is in sharing state
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ConfirmTrustedRecipientsDialog from './ConfirmTrustedRecipientsDialog';
|
|
2
|
+
var meta = {
|
|
3
|
+
component: ConfirmTrustedRecipientsDialog,
|
|
4
|
+
args: {
|
|
5
|
+
recipientsToBeConfirmed: [{
|
|
6
|
+
instance: 'https://example.com',
|
|
7
|
+
isOwner: false,
|
|
8
|
+
status: 'ready',
|
|
9
|
+
recipientConfirmationData: null,
|
|
10
|
+
verifyRecipient: function verifyRecipient() {},
|
|
11
|
+
fadeIn: true,
|
|
12
|
+
type: 'two-way',
|
|
13
|
+
onRevoke: function onRevoke() {},
|
|
14
|
+
onRevokeSelf: function onRevokeSelf() {}
|
|
15
|
+
}]
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export var Default = {
|
|
20
|
+
name: 'Default',
|
|
21
|
+
args: {
|
|
22
|
+
twoStepsConfirmationMethods: {
|
|
23
|
+
getRecipientsToBeConfirmed: function getRecipientsToBeConfirmed() {
|
|
24
|
+
return [{
|
|
25
|
+
name: 'John Doe',
|
|
26
|
+
instance: 'https://example.com',
|
|
27
|
+
isOwner: false,
|
|
28
|
+
status: 'ready'
|
|
29
|
+
}, {
|
|
30
|
+
name: 'Alice Doe',
|
|
31
|
+
instance: 'https://example.com',
|
|
32
|
+
isOwner: false,
|
|
33
|
+
status: 'ready'
|
|
34
|
+
}];
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
verifyRecipient: function verifyRecipient() {}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useState } from 'react';
|
|
2
3
|
import { useClient } from 'cozy-client';
|
|
3
4
|
import Fade from 'cozy-ui/transpiled/react/Fade';
|
|
4
5
|
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
@@ -6,7 +7,9 @@ import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
|
6
7
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction';
|
|
7
8
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
8
9
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
9
11
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
12
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail';
|
|
10
13
|
import { GroupRecipientPermissions } from './GroupRecipientPermissions';
|
|
11
14
|
import { FADE_IN_DURATION } from '../../helpers/recipients';
|
|
12
15
|
import { GroupAvatar } from '../Avatar/GroupAvatar';
|
|
@@ -14,12 +17,22 @@ import { GroupAvatar } from '../Avatar/GroupAvatar';
|
|
|
14
17
|
var GroupRecipient = function GroupRecipient(props) {
|
|
15
18
|
var name = props.name,
|
|
16
19
|
members = props.members,
|
|
17
|
-
fadeIn = props.fadeIn
|
|
20
|
+
fadeIn = props.fadeIn,
|
|
21
|
+
owner = props.owner;
|
|
18
22
|
|
|
19
23
|
var _useI18n = useI18n(),
|
|
20
24
|
t = _useI18n.t;
|
|
21
25
|
|
|
22
26
|
var client = useClient();
|
|
27
|
+
|
|
28
|
+
var _useBreakpoints = useBreakpoints(),
|
|
29
|
+
isMobile = _useBreakpoints.isMobile;
|
|
30
|
+
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isDetailOpened = _useState2[0],
|
|
34
|
+
setDetailOpened = _useState2[1];
|
|
35
|
+
|
|
23
36
|
var nbMember = members.length;
|
|
24
37
|
var nbMemberReady = members.filter(function (member) {
|
|
25
38
|
return !['revoked', 'mail-not-sent'].includes(member.status);
|
|
@@ -27,11 +40,22 @@ var GroupRecipient = function GroupRecipient(props) {
|
|
|
27
40
|
var isCurrentInstanceInsideMembers = members.some(function (member) {
|
|
28
41
|
return member.instance === client.options.uri;
|
|
29
42
|
});
|
|
30
|
-
|
|
43
|
+
|
|
44
|
+
var toogleDetailOpened = function toogleDetailOpened() {
|
|
45
|
+
setDetailOpened(!isDetailOpened);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var closeDetail = function closeDetail() {
|
|
49
|
+
setDetailOpened(false);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Fade, {
|
|
31
53
|
in: true,
|
|
32
54
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
33
55
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
34
|
-
|
|
56
|
+
button: true,
|
|
57
|
+
onClick: toogleDetailOpened,
|
|
58
|
+
gutters: isMobile ? 'default' : 'double'
|
|
35
59
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(GroupAvatar, {
|
|
36
60
|
size: "small"
|
|
37
61
|
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
@@ -43,7 +67,14 @@ var GroupRecipient = function GroupRecipient(props) {
|
|
|
43
67
|
nbMember: nbMember,
|
|
44
68
|
nbMemberReady: nbMemberReady
|
|
45
69
|
}) + (isCurrentInstanceInsideMembers ? " (".concat(t('GroupRecipient.secondary_you'), ")") : '')
|
|
46
|
-
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction,
|
|
70
|
+
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction, {
|
|
71
|
+
className: isMobile ? 'u-mr-1' : 'u-mr-2'
|
|
72
|
+
}, /*#__PURE__*/React.createElement(GroupRecipientPermissions, props)))), isDetailOpened ? /*#__PURE__*/React.createElement(GroupRecipientDetail, {
|
|
73
|
+
owner: owner,
|
|
74
|
+
name: name,
|
|
75
|
+
members: members,
|
|
76
|
+
onClose: closeDetail
|
|
77
|
+
}) : null);
|
|
47
78
|
};
|
|
48
79
|
|
|
49
80
|
export { GroupRecipient };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
3
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
4
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
5
|
+
import { GroupRecipientDetailWithAccess } from './GroupRecipientDetailWithAccess';
|
|
6
|
+
import { GroupRecipientDetailWithoutAccess } from './GroupRecipientDetailWithoutAccess';
|
|
7
|
+
|
|
8
|
+
var GroupRecipientDetail = function GroupRecipientDetail(_ref) {
|
|
9
|
+
var name = _ref.name,
|
|
10
|
+
owner = _ref.owner,
|
|
11
|
+
members = _ref.members,
|
|
12
|
+
onClose = _ref.onClose;
|
|
13
|
+
|
|
14
|
+
var _useI18n = useI18n(),
|
|
15
|
+
t = _useI18n.t;
|
|
16
|
+
|
|
17
|
+
var withAccess = members.filter(function (member) {
|
|
18
|
+
return !['revoked', 'mail-not-sent'].includes(member.status);
|
|
19
|
+
});
|
|
20
|
+
var withoutAccess = members.filter(function (member) {
|
|
21
|
+
return ['revoked', 'mail-not-sent'].includes(member.status);
|
|
22
|
+
});
|
|
23
|
+
var ownerName = owner.public_name;
|
|
24
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
25
|
+
open: true,
|
|
26
|
+
size: "small",
|
|
27
|
+
onClose: onClose,
|
|
28
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, name, ownerName ? /*#__PURE__*/React.createElement(Typography, {
|
|
29
|
+
variant: "caption"
|
|
30
|
+
}, t('GroupRecipientDetail.subtitle', {
|
|
31
|
+
ownerName: ownerName
|
|
32
|
+
})) : null),
|
|
33
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "u-flex u-stack-xs u-flex-column"
|
|
35
|
+
}, withAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithAccess, {
|
|
36
|
+
withAccess: withAccess
|
|
37
|
+
}) : null, withoutAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithoutAccess, {
|
|
38
|
+
withoutAccess: withoutAccess
|
|
39
|
+
}) : null)
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { GroupRecipientDetail };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail';
|
|
2
|
+
var meta = {
|
|
3
|
+
component: GroupRecipientDetail,
|
|
4
|
+
args: {
|
|
5
|
+
name: 'Family',
|
|
6
|
+
owner: {
|
|
7
|
+
public_name: 'Alice'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export var Default = {
|
|
13
|
+
name: 'Default',
|
|
14
|
+
args: {
|
|
15
|
+
members: [{
|
|
16
|
+
name: 'Alice',
|
|
17
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
18
|
+
status: 'ready'
|
|
19
|
+
}, {
|
|
20
|
+
name: 'marine@google.com',
|
|
21
|
+
status: 'mail-not-sent'
|
|
22
|
+
}, {
|
|
23
|
+
email: 'Martin',
|
|
24
|
+
status: 'pending'
|
|
25
|
+
}, {
|
|
26
|
+
name: 'Paul',
|
|
27
|
+
status: 'revoked'
|
|
28
|
+
}]
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export var OnlyWithAccess = {
|
|
32
|
+
name: 'OnlyWithAccess',
|
|
33
|
+
args: {
|
|
34
|
+
members: [{
|
|
35
|
+
name: 'Alice',
|
|
36
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
37
|
+
status: 'ready'
|
|
38
|
+
}, {
|
|
39
|
+
name: 'Martin',
|
|
40
|
+
status: 'pending'
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export var OnlyWithoutAccess = {
|
|
45
|
+
name: 'OnlyWithoutAccess',
|
|
46
|
+
args: {
|
|
47
|
+
members: [{
|
|
48
|
+
name: 'marine@google.com',
|
|
49
|
+
status: 'mail-not-sent'
|
|
50
|
+
}, {
|
|
51
|
+
name: 'Paul',
|
|
52
|
+
status: 'revoked'
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
};
|