cozy-sharing 33.4.2 → 33.4.3

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
+ ## [33.4.3](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.4.2...cozy-sharing@33.4.3) (2026-06-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cozy-sharing:** Remove revoked sharing after last recipient ([e0f486c](https://github.com/cozy/cozy-libs/commit/e0f486cd9b7805e8214c5586f0d7b2c7aed50491))
11
+
6
12
  ## [33.4.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.4.1...cozy-sharing@33.4.2) (2026-06-16)
7
13
 
8
14
  ### Bug Fixes
package/dist/state.js CHANGED
@@ -337,6 +337,12 @@ var sharings = function sharings() {
337
337
  case UPDATE_SHARING:
338
338
  case REVOKE_GROUP:
339
339
  case REVOKE_RECIPIENT:
340
+ if (!isSharingADrive(action.sharing) && areAllRecipientsRevoked(action.sharing)) {
341
+ return state.filter(function (s) {
342
+ return s.id !== action.sharing.id;
343
+ });
344
+ }
345
+
340
346
  return state.map(function (s) {
341
347
  return s.id !== action.sharing.id ? s : action.sharing;
342
348
  });
@@ -254,6 +254,18 @@ describe('Sharing state', function () {
254
254
  expect(state.sharings[0].attributes.members[1].status).toEqual('revoked');
255
255
  expect(state.sharings[0].attributes.members[2].id).toEqual(SHARING_1.attributes.members[2].id);
256
256
  });
257
+ it('should forget a sharing when revoking the last recipient', function () {
258
+ var state = reducer(reducer(undefined, receiveSharings({
259
+ sharings: [SHARING_1, SHARING_2]
260
+ })), revokeRecipient(SHARING_2, 1));
261
+ expect(state.byDocId).toEqual({
262
+ folder_1: {
263
+ sharings: [SHARING_1.id],
264
+ permissions: []
265
+ }
266
+ });
267
+ expect(state.sharings).toEqual([SHARING_1]);
268
+ });
257
269
  it('should revoke self', function () {
258
270
  var state = reducer(reducer(undefined, receiveSharings({
259
271
  sharings: [SHARING_1, SHARING_2]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "33.4.2",
3
+ "version": "33.4.3",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -83,5 +83,5 @@
83
83
  "sideEffects": [
84
84
  "*.css"
85
85
  ],
86
- "gitHead": "ce6730dfc4d047382e31c566f7e066ad9d7eb195"
86
+ "gitHead": "832c42dbcfdc5db673a0b225163b953031def5de"
87
87
  }
package/src/state.js CHANGED
@@ -258,6 +258,12 @@ const sharings = (state = [], action) => {
258
258
  case UPDATE_SHARING:
259
259
  case REVOKE_GROUP:
260
260
  case REVOKE_RECIPIENT:
261
+ if (
262
+ !isSharingADrive(action.sharing) &&
263
+ areAllRecipientsRevoked(action.sharing)
264
+ ) {
265
+ return state.filter(s => s.id !== action.sharing.id)
266
+ }
261
267
  return state.map(s => {
262
268
  return s.id !== action.sharing.id ? s : action.sharing
263
269
  })
package/src/state.spec.js CHANGED
@@ -343,6 +343,22 @@ describe('Sharing state', () => {
343
343
  )
344
344
  })
345
345
 
346
+ it('should forget a sharing when revoking the last recipient', () => {
347
+ const state = reducer(
348
+ reducer(
349
+ undefined,
350
+ receiveSharings({
351
+ sharings: [SHARING_1, SHARING_2]
352
+ })
353
+ ),
354
+ revokeRecipient(SHARING_2, 1)
355
+ )
356
+ expect(state.byDocId).toEqual({
357
+ folder_1: { sharings: [SHARING_1.id], permissions: [] }
358
+ })
359
+ expect(state.sharings).toEqual([SHARING_1])
360
+ })
361
+
346
362
  it('should revoke self', () => {
347
363
  const state = reducer(
348
364
  reducer(