cozy-sharing 39.0.1 → 39.0.2

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 CHANGED
@@ -3,6 +3,12 @@
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
+ ## [39.0.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@39.0.1...cozy-sharing@39.0.2) (2026-10-06)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cozy-sharing:** Avoid falling back to driveId for nested sharing ([eac16ad](https://github.com/cozy/cozy-libs/commit/eac16ad94e2eddab74ea0d9b249cb91a05e98ac1))
11
+
6
12
  ## [39.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@39.0.0...cozy-sharing@39.0.1) (2026-10-06)
7
13
 
8
14
  **Note:** Version bump only for package cozy-sharing
@@ -136,9 +136,8 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
136
136
  while (1) switch (_context2.prev = _context2.next) {
137
137
  case 0:
138
138
  document = _ref2.document, recipients = _ref2.recipients, readOnlyRecipients = _ref2.readOnlyRecipients, description = _ref2.description, openSharing = _ref2.openSharing, sharedDrive = _ref2.sharedDrive;
139
- _this2$props2 = _this2.props, client = _this2$props2.client, doctype = _this2$props2.doctype; // Documents nested in a shared drive have no sharing of their own
140
-
141
- sharing = getDocumentSharing(_this2.state, document.id) || (document.driveId ? _getSharingById(_this2.state, document.driveId) : null);
139
+ _this2$props2 = _this2.props, client = _this2$props2.client, doctype = _this2$props2.doctype;
140
+ sharing = getDocumentSharing(_this2.state, document.id);
142
141
 
143
142
  if (!sharing) {
144
143
  _context2.next = 12;
@@ -793,21 +793,18 @@ describe('shared drive recipient revocation', function () {
793
793
  }
794
794
  }, _callee14);
795
795
  })));
796
- it('adds recipients to the existing shared drive when sharing a document nested inside it', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
796
+ it('creates a new sharing when sharing a document nested inside a shared drive without its own sharing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
797
797
  var nestedDocument;
798
798
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
799
799
  while (1) switch (_context15.prev = _context15.next) {
800
800
  case 0:
801
- sharingCol.addRecipients.mockResolvedValue({
802
- data: SHARED_DRIVE
803
- });
804
801
  nestedDocument = {
805
802
  _id: 'nested_folder_456',
806
803
  id: 'nested_folder_456',
807
804
  driveId: SHARED_DRIVE.id,
808
805
  path: '/Shared folder/Sub folder'
809
806
  };
810
- _context15.next = 4;
807
+ _context15.next = 3;
811
808
  return provider.share({
812
809
  document: nestedDocument,
813
810
  recipients: [recipient],
@@ -817,15 +814,19 @@ describe('shared drive recipient revocation', function () {
817
814
  sharedDrive: true
818
815
  });
819
816
 
820
- case 4:
821
- expect(sharingCol.create).not.toHaveBeenCalled();
822
- expect(sharingCol.addRecipients).toHaveBeenCalledWith({
823
- document: SHARED_DRIVE,
817
+ case 3:
818
+ expect(sharingCol.create).toHaveBeenCalledWith({
819
+ document: nestedDocument,
824
820
  recipients: [recipient],
825
- readOnlyRecipients: []
821
+ readOnlyRecipients: [],
822
+ description: 'Sub folder',
823
+ previewPath: '/preview',
824
+ openSharing: false,
825
+ sharedDrive: true
826
826
  });
827
+ expect(sharingCol.addRecipients).not.toHaveBeenCalled();
827
828
 
828
- case 6:
829
+ case 5:
829
830
  case "end":
830
831
  return _context15.stop();
831
832
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "39.0.1",
3
+ "version": "39.0.2",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -58,7 +58,7 @@
58
58
  "cozy-intent": "^2.31.1",
59
59
  "cozy-minilog": "^3.10.1",
60
60
  "cozy-ui": "^140.5.0",
61
- "cozy-ui-plus": "^14.0.0",
61
+ "cozy-ui-plus": "^14.0.1",
62
62
  "jest": "30.3.0",
63
63
  "jest-environment-jsdom": "30.3.0",
64
64
  "react": "16.12.0",
@@ -84,5 +84,5 @@
84
84
  "sideEffects": [
85
85
  "*.css"
86
86
  ],
87
- "gitHead": "10d189a754a9ad65733ac9d1921834da3782e77b"
87
+ "gitHead": "a9f046c1c02c5ffc85bf5c46da1acb41407dc584"
88
88
  }
@@ -260,10 +260,7 @@ export class SharingProvider extends Component {
260
260
  sharedDrive
261
261
  }) => {
262
262
  const { client, doctype } = this.props
263
- // Documents nested in a shared drive have no sharing of their own
264
- const sharing =
265
- getDocumentSharing(this.state, document.id) ||
266
- (document.driveId ? getSharingById(this.state, document.driveId) : null)
263
+ const sharing = getDocumentSharing(this.state, document.id)
267
264
  if (sharing) {
268
265
  const sharingResult = await this.addRecipients({
269
266
  document: sharing,
@@ -572,8 +572,7 @@ describe('shared drive recipient revocation', () => {
572
572
  })
573
573
  })
574
574
 
575
- it('adds recipients to the existing shared drive when sharing a document nested inside it', async () => {
576
- sharingCol.addRecipients.mockResolvedValue({ data: SHARED_DRIVE })
575
+ it('creates a new sharing when sharing a document nested inside a shared drive without its own sharing', async () => {
577
576
  const nestedDocument = {
578
577
  _id: 'nested_folder_456',
579
578
  id: 'nested_folder_456',
@@ -590,12 +589,16 @@ describe('shared drive recipient revocation', () => {
590
589
  sharedDrive: true
591
590
  })
592
591
 
593
- expect(sharingCol.create).not.toHaveBeenCalled()
594
- expect(sharingCol.addRecipients).toHaveBeenCalledWith({
595
- document: SHARED_DRIVE,
592
+ expect(sharingCol.create).toHaveBeenCalledWith({
593
+ document: nestedDocument,
596
594
  recipients: [recipient],
597
- readOnlyRecipients: []
595
+ readOnlyRecipients: [],
596
+ description: 'Sub folder',
597
+ previewPath: '/preview',
598
+ openSharing: false,
599
+ sharedDrive: true
598
600
  })
601
+ expect(sharingCol.addRecipients).not.toHaveBeenCalled()
599
602
  })
600
603
 
601
604
  it('clears effective recipients when the sharing was deleted (404)', async () => {