cozy-sharing 28.5.0 → 28.7.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 +15 -0
- package/dist/SharingProvider.js +186 -87
- package/dist/SharingProvider.spec.js +152 -0
- package/dist/components/Recipient/LinkRecipient.js +27 -8
- package/dist/components/Recipient/LinkRecipient.stories.js +0 -1
- package/dist/components/Recipient/LinkRecipientPermissions.js +62 -15
- package/dist/components/Recipient/MemberRecipient.spec.js +13 -0
- package/dist/components/Recipient/MemberRecipientPermissions.js +80 -20
- package/dist/components/Recipient/MemberRecipientPermissions.spec.js +214 -0
- package/dist/components/Recipient/actions/revokeLink.js +34 -0
- package/dist/components/Recipient/actions/setReadOnlySharedPermission.js +0 -1
- package/dist/components/Recipient/actions/setReadOnlySharedPermission.spec.js +72 -0
- package/dist/components/Recipient/actions/setReadWriteSharedPermission.js +0 -1
- package/dist/components/Recipient/actions/setReadWriteSharedPermission.spec.js +72 -0
- package/dist/components/ShareDialogCozyToCozy.spec.js +9 -0
- package/dist/components/WhoHasAccess.js +0 -1
- package/locales/en.json +4 -1
- package/locales/fr.json +4 -1
- package/locales/ru.json +4 -1
- package/locales/vi.json +4 -1
- package/package.json +2 -2
- package/src/SharingProvider.jsx +52 -1
- package/src/SharingProvider.spec.jsx +94 -0
- package/src/components/Recipient/LinkRecipient.jsx +30 -7
- package/src/components/Recipient/LinkRecipient.stories.jsx +0 -1
- package/src/components/Recipient/LinkRecipientPermissions.jsx +54 -16
- package/src/components/Recipient/MemberRecipient.spec.jsx +11 -0
- package/src/components/Recipient/MemberRecipientPermissions.jsx +69 -16
- package/src/components/Recipient/MemberRecipientPermissions.spec.jsx +165 -0
- package/src/components/Recipient/actions/revokeLink.js +33 -0
- package/src/components/Recipient/actions/setReadOnlySharedPermission.js +1 -1
- package/src/components/Recipient/actions/setReadOnlySharedPermission.spec.jsx +95 -0
- package/src/components/Recipient/actions/setReadWriteSharedPermission.js +1 -1
- package/src/components/Recipient/actions/setReadWriteSharedPermission.spec.jsx +95 -0
- package/src/components/ShareDialogCozyToCozy.spec.jsx +6 -0
- package/src/components/WhoHasAccess.jsx +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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
|
+
# [28.7.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.6.0...cozy-sharing@28.7.0) (2026-03-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Allow to change link editing rights directly from the share modal ([57c3e61](https://github.com/cozy/cozy-libs/commit/57c3e6144649d3102c37961b4953219bdfe553a3))
|
|
11
|
+
- Display the Share restriction modal on click on the sharing link ([a875c36](https://github.com/cozy/cozy-libs/commit/a875c36e7b6ea592b25cbc8386a305b1c1dac516))
|
|
12
|
+
|
|
13
|
+
# [28.6.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.5.0...cozy-sharing@28.6.0) (2026-03-11)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- Add ability to change member permission type in sharing ([76d0dce](https://github.com/cozy/cozy-libs/commit/76d0dce150d8ea7ac7cb12c6e00b340756b6512a))
|
|
18
|
+
- Hide link text in link recipient ([209857f](https://github.com/cozy/cozy-libs/commit/209857fcf01b71e584e49ef8ab3da4a897d408ed))
|
|
19
|
+
- Remove link prop from LinkRecipient component ([7bbf831](https://github.com/cozy/cozy-libs/commit/7bbf831594d7c33357ade79665f4308fd35e2b8e))
|
|
20
|
+
|
|
6
21
|
# [28.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.4.4...cozy-sharing@28.5.0) (2026-03-10)
|
|
7
22
|
|
|
8
23
|
### Bug Fixes
|
package/dist/SharingProvider.js
CHANGED
|
@@ -463,48 +463,143 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
463
463
|
};
|
|
464
464
|
}());
|
|
465
465
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Update a sharing member's read_only field to change permission type
|
|
468
|
+
* @param {string} sharingId - The ID of the sharing
|
|
469
|
+
* @param {number} memberIndex - The index of the member in the sharing members array
|
|
470
|
+
* @param {string} newType - 'one-way' for read-only, 'two-way' for read-write
|
|
471
|
+
*/
|
|
472
|
+
_defineProperty(_this2, "updateSharingMemberType", /*#__PURE__*/function () {
|
|
473
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(sharingId, memberIndex, newType) {
|
|
474
|
+
var sharing, member, matchedContacts, contact, readOnly;
|
|
469
475
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
470
476
|
while (1) switch (_context10.prev = _context10.next) {
|
|
471
477
|
case 0:
|
|
472
|
-
|
|
478
|
+
sharing = _getSharingById(_this2.state, sharingId);
|
|
479
|
+
|
|
480
|
+
if (sharing) {
|
|
481
|
+
_context10.next = 3;
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
throw new Error('Sharing not found');
|
|
486
|
+
|
|
487
|
+
case 3:
|
|
488
|
+
member = sharing.attributes.members[memberIndex];
|
|
489
|
+
|
|
490
|
+
if (member) {
|
|
473
491
|
_context10.next = 6;
|
|
474
492
|
break;
|
|
475
493
|
}
|
|
476
494
|
|
|
477
|
-
|
|
495
|
+
throw new Error('Member not found');
|
|
496
|
+
|
|
497
|
+
case 6:
|
|
498
|
+
_context10.next = 8;
|
|
499
|
+
return _this2.props.client.collection('io.cozy.contacts').find({
|
|
500
|
+
email: {
|
|
501
|
+
$elemMatch: {
|
|
502
|
+
address: member.email
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
_id: {
|
|
506
|
+
$gt: null
|
|
507
|
+
}
|
|
508
|
+
}, {
|
|
509
|
+
indexedFields: ['_id']
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
case 8:
|
|
513
|
+
matchedContacts = _context10.sent;
|
|
514
|
+
|
|
515
|
+
if (matchedContacts.data.length) {
|
|
516
|
+
_context10.next = 11;
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
throw new Error("Contact not found for member ".concat(member.email));
|
|
521
|
+
|
|
522
|
+
case 11:
|
|
523
|
+
contact = matchedContacts.data[0]; // Revoke (API call only, no state dispatch to avoid UI flickering)
|
|
524
|
+
|
|
525
|
+
_context10.next = 14;
|
|
526
|
+
return _this2.sharingCol.revokeRecipient(sharing, memberIndex);
|
|
527
|
+
|
|
528
|
+
case 14:
|
|
529
|
+
// Re-add with the new permission type
|
|
530
|
+
readOnly = newType === 'one-way';
|
|
531
|
+
_context10.prev = 15;
|
|
532
|
+
_context10.next = 18;
|
|
533
|
+
return _this2.addRecipients({
|
|
534
|
+
document: sharing,
|
|
535
|
+
recipients: readOnly ? [] : [contact],
|
|
536
|
+
readOnlyRecipients: readOnly ? [contact] : []
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
case 18:
|
|
540
|
+
_context10.next = 24;
|
|
541
|
+
break;
|
|
542
|
+
|
|
543
|
+
case 20:
|
|
544
|
+
_context10.prev = 20;
|
|
545
|
+
_context10.t0 = _context10["catch"](15);
|
|
546
|
+
log.error("Failed to re-add member ".concat(member.email, " after revocation. The member has been revoked but could not be re-added with the new permission type."), _context10.t0);
|
|
547
|
+
throw _context10.t0;
|
|
548
|
+
|
|
549
|
+
case 24:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context10.stop();
|
|
552
|
+
}
|
|
553
|
+
}, _callee10, null, [[15, 20]]);
|
|
554
|
+
}));
|
|
555
|
+
|
|
556
|
+
return function (_x16, _x17, _x18) {
|
|
557
|
+
return _ref12.apply(this, arguments);
|
|
558
|
+
};
|
|
559
|
+
}());
|
|
560
|
+
|
|
561
|
+
_defineProperty(_this2, "shareByLink", /*#__PURE__*/function () {
|
|
562
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(document, options) {
|
|
563
|
+
var resp;
|
|
564
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
565
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
566
|
+
case 0:
|
|
567
|
+
if (!document.driveId) {
|
|
568
|
+
_context11.next = 6;
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
_context11.next = 3;
|
|
478
573
|
return _this2.createSharedDriveSharingLink(document, options);
|
|
479
574
|
|
|
480
575
|
case 3:
|
|
481
|
-
|
|
482
|
-
|
|
576
|
+
_context11.t0 = _context11.sent;
|
|
577
|
+
_context11.next = 9;
|
|
483
578
|
break;
|
|
484
579
|
|
|
485
580
|
case 6:
|
|
486
|
-
|
|
581
|
+
_context11.next = 8;
|
|
487
582
|
return _this2.permissionCol.createSharingLink(document, options);
|
|
488
583
|
|
|
489
584
|
case 8:
|
|
490
|
-
|
|
585
|
+
_context11.t0 = _context11.sent;
|
|
491
586
|
|
|
492
587
|
case 9:
|
|
493
|
-
resp =
|
|
588
|
+
resp = _context11.t0;
|
|
494
589
|
|
|
495
590
|
_this2.dispatch(addSharingLink(resp.data));
|
|
496
591
|
|
|
497
|
-
return
|
|
592
|
+
return _context11.abrupt("return", resp);
|
|
498
593
|
|
|
499
594
|
case 12:
|
|
500
595
|
case "end":
|
|
501
|
-
return
|
|
596
|
+
return _context11.stop();
|
|
502
597
|
}
|
|
503
|
-
},
|
|
598
|
+
}, _callee11);
|
|
504
599
|
}));
|
|
505
600
|
|
|
506
|
-
return function (
|
|
507
|
-
return
|
|
601
|
+
return function (_x19, _x20) {
|
|
602
|
+
return _ref13.apply(this, arguments);
|
|
508
603
|
};
|
|
509
604
|
}());
|
|
510
605
|
|
|
@@ -531,67 +626,67 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
531
626
|
});
|
|
532
627
|
|
|
533
628
|
_defineProperty(_this2, "createSharedDriveSharingLink", /*#__PURE__*/function () {
|
|
534
|
-
var
|
|
629
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(document, options) {
|
|
535
630
|
var client, drivePermissionCollection, resp;
|
|
536
|
-
return _regeneratorRuntime.wrap(function
|
|
537
|
-
while (1) switch (
|
|
631
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
632
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
538
633
|
case 0:
|
|
539
634
|
client = _this2.props.client;
|
|
540
635
|
drivePermissionCollection = client.collection('io.cozy.permissions', {
|
|
541
636
|
driveId: document.driveId
|
|
542
637
|
});
|
|
543
|
-
|
|
638
|
+
_context12.next = 4;
|
|
544
639
|
return drivePermissionCollection.createSharingLink(document, options);
|
|
545
640
|
|
|
546
641
|
case 4:
|
|
547
|
-
resp =
|
|
548
|
-
return
|
|
642
|
+
resp = _context12.sent;
|
|
643
|
+
return _context12.abrupt("return", resp);
|
|
549
644
|
|
|
550
645
|
case 6:
|
|
551
646
|
case "end":
|
|
552
|
-
return
|
|
647
|
+
return _context12.stop();
|
|
553
648
|
}
|
|
554
|
-
},
|
|
649
|
+
}, _callee12);
|
|
555
650
|
}));
|
|
556
651
|
|
|
557
|
-
return function (
|
|
558
|
-
return
|
|
652
|
+
return function (_x21, _x22) {
|
|
653
|
+
return _ref14.apply(this, arguments);
|
|
559
654
|
};
|
|
560
655
|
}());
|
|
561
656
|
|
|
562
657
|
_defineProperty(_this2, "updateSharedDrivePermissions", /*#__PURE__*/function () {
|
|
563
|
-
var
|
|
658
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(document, permissionDocument, updatedPermissions, options) {
|
|
564
659
|
var client, expiresAt, password, drivePermissionCollection, resp;
|
|
565
|
-
return _regeneratorRuntime.wrap(function
|
|
566
|
-
while (1) switch (
|
|
660
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
661
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
567
662
|
case 0:
|
|
568
663
|
client = _this2.props.client;
|
|
569
664
|
expiresAt = options.expiresAt, password = options.password;
|
|
570
665
|
drivePermissionCollection = client.collection('io.cozy.permissions', {
|
|
571
666
|
driveId: document.driveId
|
|
572
667
|
});
|
|
573
|
-
|
|
668
|
+
_context13.next = 5;
|
|
574
669
|
return drivePermissionCollection.add(permissionDocument, updatedPermissions, {
|
|
575
670
|
expiresAt: expiresAt,
|
|
576
671
|
password: password
|
|
577
672
|
});
|
|
578
673
|
|
|
579
674
|
case 5:
|
|
580
|
-
resp =
|
|
675
|
+
resp = _context13.sent;
|
|
581
676
|
|
|
582
677
|
_this2.dispatch(updateSharingLink(resp.data));
|
|
583
678
|
|
|
584
|
-
return
|
|
679
|
+
return _context13.abrupt("return", resp);
|
|
585
680
|
|
|
586
681
|
case 8:
|
|
587
682
|
case "end":
|
|
588
|
-
return
|
|
683
|
+
return _context13.stop();
|
|
589
684
|
}
|
|
590
|
-
},
|
|
685
|
+
}, _callee13);
|
|
591
686
|
}));
|
|
592
687
|
|
|
593
|
-
return function (
|
|
594
|
-
return
|
|
688
|
+
return function (_x23, _x24, _x25, _x26) {
|
|
689
|
+
return _ref15.apply(this, arguments);
|
|
595
690
|
};
|
|
596
691
|
}());
|
|
597
692
|
|
|
@@ -607,28 +702,28 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
607
702
|
* @return {Array}
|
|
608
703
|
*/
|
|
609
704
|
_defineProperty(_this2, "updateDocumentPermissions", /*#__PURE__*/function () {
|
|
610
|
-
var
|
|
705
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(document, options) {
|
|
611
706
|
var verbs, expiresAt, password, permissions, responses;
|
|
612
|
-
return _regeneratorRuntime.wrap(function
|
|
613
|
-
while (1) switch (
|
|
707
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
708
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
614
709
|
case 0:
|
|
615
710
|
verbs = options.verbs, expiresAt = options.expiresAt, password = options.password;
|
|
616
711
|
permissions = _getDocumentPermissions(_this2.state, document.id);
|
|
617
712
|
|
|
618
713
|
if (!(!permissions || permissions.length === 0)) {
|
|
619
|
-
|
|
714
|
+
_context15.next = 4;
|
|
620
715
|
break;
|
|
621
716
|
}
|
|
622
717
|
|
|
623
|
-
return
|
|
718
|
+
return _context15.abrupt("return", []);
|
|
624
719
|
|
|
625
720
|
case 4:
|
|
626
|
-
|
|
721
|
+
_context15.next = 6;
|
|
627
722
|
return Promise.all(permissions.map( /*#__PURE__*/function () {
|
|
628
|
-
var
|
|
723
|
+
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(permissionDocument) {
|
|
629
724
|
var updatedPermissions, resp;
|
|
630
|
-
return _regeneratorRuntime.wrap(function
|
|
631
|
-
while (1) switch (
|
|
725
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
726
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
632
727
|
case 0:
|
|
633
728
|
updatedPermissions = permissionDocument.attributes.permissions;
|
|
634
729
|
Object.keys(updatedPermissions).forEach(function (permType) {
|
|
@@ -636,70 +731,73 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
636
731
|
});
|
|
637
732
|
|
|
638
733
|
if (!document.driveId) {
|
|
639
|
-
|
|
734
|
+
_context14.next = 8;
|
|
640
735
|
break;
|
|
641
736
|
}
|
|
642
737
|
|
|
643
|
-
|
|
738
|
+
_context14.next = 5;
|
|
644
739
|
return _this2.updateSharedDrivePermissions(document, permissionDocument, updatedPermissions, options);
|
|
645
740
|
|
|
646
741
|
case 5:
|
|
647
|
-
|
|
648
|
-
|
|
742
|
+
_context14.t0 = _context14.sent;
|
|
743
|
+
_context14.next = 11;
|
|
649
744
|
break;
|
|
650
745
|
|
|
651
746
|
case 8:
|
|
652
|
-
|
|
747
|
+
_context14.next = 10;
|
|
653
748
|
return _this2.permissionCol.add(permissionDocument, updatedPermissions, {
|
|
654
749
|
expiresAt: expiresAt,
|
|
655
750
|
password: password
|
|
656
751
|
});
|
|
657
752
|
|
|
658
753
|
case 10:
|
|
659
|
-
|
|
754
|
+
_context14.t0 = _context14.sent;
|
|
660
755
|
|
|
661
756
|
case 11:
|
|
662
|
-
resp =
|
|
663
|
-
return _context13.abrupt("return", resp);
|
|
757
|
+
resp = _context14.t0;
|
|
664
758
|
|
|
665
|
-
|
|
759
|
+
_this2.dispatch(updateSharingLink(resp.data));
|
|
760
|
+
|
|
761
|
+
return _context14.abrupt("return", resp);
|
|
762
|
+
|
|
763
|
+
case 14:
|
|
666
764
|
case "end":
|
|
667
|
-
return
|
|
765
|
+
return _context14.stop();
|
|
668
766
|
}
|
|
669
|
-
},
|
|
767
|
+
}, _callee14);
|
|
670
768
|
}));
|
|
671
769
|
|
|
672
|
-
return function (
|
|
673
|
-
return
|
|
770
|
+
return function (_x29) {
|
|
771
|
+
return _ref17.apply(this, arguments);
|
|
674
772
|
};
|
|
675
773
|
}()));
|
|
676
774
|
|
|
677
775
|
case 6:
|
|
678
|
-
responses =
|
|
679
|
-
return
|
|
776
|
+
responses = _context15.sent;
|
|
777
|
+
return _context15.abrupt("return", responses);
|
|
680
778
|
|
|
681
779
|
case 8:
|
|
682
780
|
case "end":
|
|
683
|
-
return
|
|
781
|
+
return _context15.stop();
|
|
684
782
|
}
|
|
685
|
-
},
|
|
783
|
+
}, _callee15);
|
|
686
784
|
}));
|
|
687
785
|
|
|
688
|
-
return function (
|
|
689
|
-
return
|
|
786
|
+
return function (_x27, _x28) {
|
|
787
|
+
return _ref16.apply(this, arguments);
|
|
690
788
|
};
|
|
691
789
|
}());
|
|
692
790
|
|
|
693
791
|
_defineProperty(_this2, "revokeSharingLink", /*#__PURE__*/function () {
|
|
694
|
-
var
|
|
792
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(document) {
|
|
695
793
|
var perms;
|
|
696
|
-
return _regeneratorRuntime.wrap(function
|
|
697
|
-
while (1) switch (
|
|
794
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
795
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
698
796
|
case 0:
|
|
699
797
|
// Because some duplicate links have been created in the past, we must ensure
|
|
700
798
|
// we revoke all of them
|
|
701
799
|
perms = _getDocumentPermissions(_this2.state, document.id);
|
|
702
|
-
|
|
800
|
+
_context16.next = 3;
|
|
703
801
|
return Promise.all(perms.map(function (p) {
|
|
704
802
|
return _this2.permissionCol.destroy(p);
|
|
705
803
|
}));
|
|
@@ -709,13 +807,13 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
709
807
|
|
|
710
808
|
case 4:
|
|
711
809
|
case "end":
|
|
712
|
-
return
|
|
810
|
+
return _context16.stop();
|
|
713
811
|
}
|
|
714
|
-
},
|
|
812
|
+
}, _callee16);
|
|
715
813
|
}));
|
|
716
814
|
|
|
717
|
-
return function (
|
|
718
|
-
return
|
|
815
|
+
return function (_x30) {
|
|
816
|
+
return _ref18.apply(this, arguments);
|
|
719
817
|
};
|
|
720
818
|
}());
|
|
721
819
|
|
|
@@ -802,7 +900,8 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
802
900
|
revokeAllRecipients: _this2.revokeAllRecipients,
|
|
803
901
|
refresh: _this2.fetchAllSharings,
|
|
804
902
|
hasWriteAccess: _this2.hasWriteAccess,
|
|
805
|
-
renameSharedDrive: _this2.renameSharedDrive
|
|
903
|
+
renameSharedDrive: _this2.renameSharedDrive,
|
|
904
|
+
updateSharingMemberType: _this2.updateSharingMemberType
|
|
806
905
|
};
|
|
807
906
|
_this2.isPublic = (_props$isPublic = props.isPublic) !== null && _props$isPublic !== void 0 ? _props$isPublic : false;
|
|
808
907
|
_this2.realtime = null;
|
|
@@ -838,14 +937,14 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
838
937
|
}, {
|
|
839
938
|
key: "fetchAllSharings",
|
|
840
939
|
value: function () {
|
|
841
|
-
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
940
|
+
var _fetchAllSharings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
842
941
|
var _this$props, doctype, client, _yield$Promise$all, _yield$Promise$all2, sharings, permissions, apps, sharedDocIds, resp, folderPaths, filePaths;
|
|
843
942
|
|
|
844
|
-
return _regeneratorRuntime.wrap(function
|
|
845
|
-
while (1) switch (
|
|
943
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
944
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
846
945
|
case 0:
|
|
847
946
|
if (!this.isPublic) {
|
|
848
|
-
|
|
947
|
+
_context17.next = 4;
|
|
849
948
|
break;
|
|
850
949
|
}
|
|
851
950
|
|
|
@@ -854,17 +953,17 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
854
953
|
this.setState({
|
|
855
954
|
allLoaded: true
|
|
856
955
|
});
|
|
857
|
-
return
|
|
956
|
+
return _context17.abrupt("return");
|
|
858
957
|
|
|
859
958
|
case 4:
|
|
860
959
|
_this$props = this.props, doctype = _this$props.doctype, client = _this$props.client;
|
|
861
|
-
|
|
960
|
+
_context17.next = 7;
|
|
862
961
|
return Promise.all([this.sharingCol.findByDoctype(doctype, {
|
|
863
962
|
withSharedDocs: false
|
|
864
963
|
}), this.permissionCol.findLinksByDoctype(doctype), client.fetchQueryAndGetFromState(fetchApps())]);
|
|
865
964
|
|
|
866
965
|
case 7:
|
|
867
|
-
_yield$Promise$all =
|
|
966
|
+
_yield$Promise$all = _context17.sent;
|
|
868
967
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
869
968
|
sharings = _yield$Promise$all2[0];
|
|
870
969
|
permissions = _yield$Promise$all2[1];
|
|
@@ -879,35 +978,35 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
879
978
|
hasLoadedAtLeastOnePage: true
|
|
880
979
|
}); // eslint-disable-next-line promise/catch-or-return
|
|
881
980
|
|
|
882
|
-
|
|
981
|
+
_context17.next = 16;
|
|
883
982
|
return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
|
|
884
983
|
|
|
885
984
|
case 16:
|
|
886
985
|
if (!(doctype === 'io.cozy.files')) {
|
|
887
|
-
|
|
986
|
+
_context17.next = 26;
|
|
888
987
|
break;
|
|
889
988
|
}
|
|
890
989
|
|
|
891
990
|
sharedDocIds = getSharedDocIdsBySharings(sharings);
|
|
892
|
-
|
|
991
|
+
_context17.next = 20;
|
|
893
992
|
return client.collection(doctype).all({
|
|
894
993
|
keys: sharedDocIds
|
|
895
994
|
});
|
|
896
995
|
|
|
897
996
|
case 20:
|
|
898
|
-
resp =
|
|
997
|
+
resp = _context17.sent;
|
|
899
998
|
folderPaths = resp.data.filter(function (f) {
|
|
900
999
|
return f.type === 'directory' && !f.trashed;
|
|
901
1000
|
}).map(function (f) {
|
|
902
1001
|
return f.path;
|
|
903
1002
|
});
|
|
904
|
-
|
|
1003
|
+
_context17.next = 24;
|
|
905
1004
|
return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
|
|
906
1005
|
return f.type !== 'directory' && !f.trashed;
|
|
907
1006
|
}));
|
|
908
1007
|
|
|
909
1008
|
case 24:
|
|
910
|
-
filePaths =
|
|
1009
|
+
filePaths = _context17.sent;
|
|
911
1010
|
this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
|
|
912
1011
|
|
|
913
1012
|
case 26:
|
|
@@ -917,9 +1016,9 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
917
1016
|
|
|
918
1017
|
case 27:
|
|
919
1018
|
case "end":
|
|
920
|
-
return
|
|
1019
|
+
return _context17.stop();
|
|
921
1020
|
}
|
|
922
|
-
},
|
|
1021
|
+
}, _callee17, this);
|
|
923
1022
|
}));
|
|
924
1023
|
|
|
925
1024
|
function fetchAllSharings() {
|