cozy-sharing 40.0.0 → 40.1.1

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,16 @@
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
+ ## [40.1.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@40.1.0...cozy-sharing@40.1.1) (2026-10-22)
7
+
8
+ **Note:** Version bump only for package cozy-sharing
9
+
10
+ # [40.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@40.0.0...cozy-sharing@40.1.0) (2026-10-20)
11
+
12
+ ### Features
13
+
14
+ - **cozy-sharing:** Share nested folder as member ([6627701](https://github.com/cozy/cozy-libs/commit/6627701435d1270f92ee76cead6772f525f5c276))
15
+
6
16
  # [40.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@39.0.4...cozy-sharing@40.0.0) (2026-10-19)
7
17
 
8
18
  ### Bug Fixes
@@ -130,7 +130,7 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
130
130
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
131
131
  var _this2$props$previewP;
132
132
 
133
- var document, recipients, readOnlyRecipients, description, openSharing, sharedDrive, _this2$props2, client, doctype, sharing, sharingResult, previewPath, _yield$_this2$sharing, data;
133
+ var document, recipients, readOnlyRecipients, description, openSharing, sharedDrive, _this2$props2, client, doctype, sharing, sharingResult, previewPath, driveId, _yield$_this2$sharing, data;
134
134
 
135
135
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
136
136
  while (1) switch (_context2.prev = _context2.next) {
@@ -168,8 +168,11 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
168
168
  return _context2.abrupt("return", sharingResult);
169
169
 
170
170
  case 12:
171
- previewPath = (_this2$props$previewP = _this2.props.previewPath) !== null && _this2$props$previewP !== void 0 ? _this2$props$previewP : '/preview';
172
- _context2.next = 15;
171
+ previewPath = (_this2$props$previewP = _this2.props.previewPath) !== null && _this2$props$previewP !== void 0 ? _this2$props$previewP : '/preview'; // Pass driveId so SharingCollection delegates the creation to the drive
172
+ // owner's instance when the document lives in a shared drive we don't own.
173
+
174
+ driveId = document.driveId;
175
+ _context2.next = 16;
173
176
  return _this2.sharingCol.create({
174
177
  document: document,
175
178
  recipients: recipients,
@@ -177,10 +180,11 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
177
180
  description: description,
178
181
  previewPath: previewPath,
179
182
  openSharing: openSharing,
180
- sharedDrive: sharedDrive
183
+ sharedDrive: sharedDrive,
184
+ driveId: driveId
181
185
  });
182
186
 
183
- case 15:
187
+ case 16:
184
188
  _yield$_this2$sharing = _context2.sent;
185
189
  data = _yield$_this2$sharing.data;
186
190
  _context2.t0 = _this2;
@@ -189,37 +193,37 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
189
193
  _context2.t3 = document.path;
190
194
 
191
195
  if (_context2.t3) {
192
- _context2.next = 25;
196
+ _context2.next = 26;
193
197
  break;
194
198
  }
195
199
 
196
- _context2.next = 24;
200
+ _context2.next = 25;
197
201
  return fetchFilesPaths(client, doctype, [document]);
198
202
 
199
- case 24:
203
+ case 25:
200
204
  _context2.t3 = _context2.sent;
201
205
 
202
- case 25:
206
+ case 26:
203
207
  _context2.t4 = _context2.t3;
204
208
  _context2.t5 = (0, _context2.t1)(_context2.t2, _context2.t4);
205
209
 
206
210
  _context2.t0.dispatch.call(_context2.t0, _context2.t5);
207
211
 
208
- _context2.next = 30;
212
+ _context2.next = 31;
209
213
  return _this2.state.onShared({
210
214
  document: document,
211
215
  recipients: recipients,
212
216
  readOnlyRecipients: readOnlyRecipients
213
217
  });
214
218
 
215
- case 30:
216
- _context2.next = 32;
219
+ case 31:
220
+ _context2.next = 33;
217
221
  return _this2.fetchEffectiveRecipients(getDocumentId(document), document.driveId);
218
222
 
219
- case 32:
223
+ case 33:
220
224
  return _context2.abrupt("return", data);
221
225
 
222
- case 33:
226
+ case 34:
223
227
  case "end":
224
228
  return _context2.stop();
225
229
  }
@@ -715,8 +715,9 @@ describe('shared drive recipient revocation', function () {
715
715
  };
716
716
  var provider;
717
717
  var sharingCol;
718
+ var mockClient;
718
719
  beforeEach(function () {
719
- var mockClient = createMockClient({});
720
+ mockClient = createMockClient({});
720
721
 
721
722
  mockClient.getStackClient = function () {
722
723
  return {
@@ -733,6 +734,7 @@ describe('shared drive recipient revocation', function () {
733
734
  create: jest.fn().mockResolvedValue({
734
735
  data: NEW_SHARING
735
736
  }),
737
+ createSharedDrive: jest.fn(),
736
738
  revokeRecipient: jest.fn().mockResolvedValue({}),
737
739
  fetchEffectiveRecipients: jest.fn().mockResolvedValue({
738
740
  data: []
@@ -822,11 +824,13 @@ describe('shared drive recipient revocation', function () {
822
824
  description: 'Sub folder',
823
825
  previewPath: '/preview',
824
826
  openSharing: false,
825
- sharedDrive: true
827
+ sharedDrive: true,
828
+ driveId: SHARED_DRIVE.id
826
829
  });
827
830
  expect(sharingCol.addRecipients).not.toHaveBeenCalled();
831
+ expect(sharingCol.createSharedDrive).not.toHaveBeenCalled();
828
832
 
829
- case 5:
833
+ case 6:
830
834
  case "end":
831
835
  return _context15.stop();
832
836
  }
package/jest.config.js CHANGED
@@ -23,9 +23,9 @@ module.exports = {
23
23
  // identity-obj-proxy module is installed by cozy-scripts
24
24
  '.styl$': 'identity-obj-proxy',
25
25
  '^cozy-logger$': 'cozy-logger/dist/index.js',
26
- '^cozy-client$': '<rootDir>/../../node_modules/cozy-client/dist/index.js',
26
+ '^cozy-client$': '<rootDir>/node_modules/cozy-client/dist/index.js',
27
27
  '^cozy-client/dist/types$':
28
- '<rootDir>/../../node_modules/cozy-client/dist/types.js',
28
+ '<rootDir>/node_modules/cozy-client/dist/types.js',
29
29
  '^twake-i18n$': '<rootDir>/../twake-i18n/dist/index.js'
30
30
  },
31
31
  transformIgnorePatterns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "40.0.0",
3
+ "version": "40.1.1",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -53,12 +53,12 @@
53
53
  "babel-jest": "30.3.0",
54
54
  "babel-plugin-css-modules-transform": "1.6.2",
55
55
  "babel-plugin-inline-react-svg": "1.1.2",
56
- "cozy-client": "^60.28.0",
56
+ "cozy-client": "^60.45.0",
57
57
  "cozy-device-helper": "^4.0.0",
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.4",
61
+ "cozy-ui-plus": "^14.0.6",
62
62
  "jest": "30.3.0",
63
63
  "jest-environment-jsdom": "30.3.0",
64
64
  "react": "16.12.0",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@linagora/twake-icons": ">=2.9.0",
72
- "cozy-client": ">=60.28.0",
72
+ "cozy-client": ">=60.45.0",
73
73
  "cozy-device-helper": ">=4.0.0",
74
74
  "cozy-flags": ">=4.8.1",
75
75
  "cozy-intent": ">=2.29.1",
@@ -84,5 +84,5 @@
84
84
  "sideEffects": [
85
85
  "*.css"
86
86
  ],
87
- "gitHead": "16f6ad8265fe6d1265dc944ca73c9274cf26f7ea"
87
+ "gitHead": "e846871f99f90ba769173affd41b16d9bd134824"
88
88
  }
@@ -280,6 +280,10 @@ export class SharingProvider extends Component {
280
280
 
281
281
  const previewPath = this.props.previewPath ?? '/preview'
282
282
 
283
+ // Pass driveId so SharingCollection delegates the creation to the drive
284
+ // owner's instance when the document lives in a shared drive we don't own.
285
+ const { driveId } = document
286
+
283
287
  const { data } = await this.sharingCol.create({
284
288
  document,
285
289
  recipients,
@@ -287,7 +291,8 @@ export class SharingProvider extends Component {
287
291
  description,
288
292
  previewPath,
289
293
  openSharing,
290
- sharedDrive
294
+ sharedDrive,
295
+ driveId
291
296
  })
292
297
 
293
298
  this.dispatch(
@@ -521,9 +521,10 @@ describe('shared drive recipient revocation', () => {
521
521
 
522
522
  let provider
523
523
  let sharingCol
524
+ let mockClient
524
525
 
525
526
  beforeEach(() => {
526
- const mockClient = createMockClient({})
527
+ mockClient = createMockClient({})
527
528
  mockClient.getStackClient = () => ({ uri: 'http://cozy.local' })
528
529
  mockClient.collection = jest.fn().mockReturnValue({})
529
530
 
@@ -535,6 +536,7 @@ describe('shared drive recipient revocation', () => {
535
536
  sharingCol = {
536
537
  addRecipients: jest.fn(),
537
538
  create: jest.fn().mockResolvedValue({ data: NEW_SHARING }),
539
+ createSharedDrive: jest.fn(),
538
540
  revokeRecipient: jest.fn().mockResolvedValue({}),
539
541
  fetchEffectiveRecipients: jest.fn().mockResolvedValue({ data: [] })
540
542
  }
@@ -596,9 +598,11 @@ describe('shared drive recipient revocation', () => {
596
598
  description: 'Sub folder',
597
599
  previewPath: '/preview',
598
600
  openSharing: false,
599
- sharedDrive: true
601
+ sharedDrive: true,
602
+ driveId: SHARED_DRIVE.id
600
603
  })
601
604
  expect(sharingCol.addRecipients).not.toHaveBeenCalled()
605
+ expect(sharingCol.createSharedDrive).not.toHaveBeenCalled()
602
606
  })
603
607
 
604
608
  it('clears effective recipients when the sharing was deleted (404)', async () => {