cozy-sharing 33.4.3 → 33.5.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 +6 -0
- package/dist/SharingProvider.js +7 -1
- package/dist/state.js +15 -0
- package/package.json +2 -2
- package/src/SharingProvider.jsx +4 -0
- package/src/state.js +18 -0
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.5.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.4.3...cozy-sharing@33.5.0) (2026-06-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Add isOrgSharedDrive and canLeave helpers ([f93d4bb](https://github.com/cozy/cozy-libs/commit/f93d4bb37cd748a7e18db3a3ac67e1b84e819440))
|
|
11
|
+
|
|
6
12
|
## [33.4.3](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.4.2...cozy-sharing@33.4.3) (2026-06-16)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/dist/SharingProvider.js
CHANGED
|
@@ -41,7 +41,7 @@ import { getSharingObject, createSharingInStore, updateSharingInStore } from './
|
|
|
41
41
|
import { getShortcode } from './helpers/shortcodes';
|
|
42
42
|
import { SynchronousJobQueue } from './helpers/synchronousJobQueue';
|
|
43
43
|
import { fetchApps } from './queries/queries';
|
|
44
|
-
import reducer, { receiveSharings, addSharing, updateSharing, addSharingLink, updateSharingLink, revokeSharingLink, revokeRecipient, revokeGroup as revokeGroupFromState, revokeSelf, receivePaths, isOwner as _isOwner, isSharedDrive as _isSharedDrive, canReshare as _canReshare, getOwner as _getOwner, getRecipients as _getRecipients, getSharingById as _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, getSharedDriveSharingType, SHARING_TYPE } from './state';
|
|
44
|
+
import reducer, { receiveSharings, addSharing, updateSharing, addSharingLink, updateSharingLink, revokeSharingLink, revokeRecipient, revokeGroup as revokeGroupFromState, revokeSelf, receivePaths, isOwner as _isOwner, isSharedDrive as _isSharedDrive, isOrgSharedDrive as _isOrgSharedDrive, canLeave as _canLeave, canReshare as _canReshare, getOwner as _getOwner, getRecipients as _getRecipients, getSharingById as _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, getSharedDriveSharingType, SHARING_TYPE } from './state';
|
|
45
45
|
var log = minilog('SharingProvider');
|
|
46
46
|
var SHARING_DOCTYPE = 'io.cozy.sharings';
|
|
47
47
|
var PERMISSION_DOCTYPE = 'io.cozy.permissions';
|
|
@@ -997,6 +997,12 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
|
|
|
997
997
|
isSharedDrive: function isSharedDrive(docId) {
|
|
998
998
|
return _isSharedDrive(_this2.state, docId);
|
|
999
999
|
},
|
|
1000
|
+
isOrgSharedDrive: function isOrgSharedDrive(docId) {
|
|
1001
|
+
return _isOrgSharedDrive(_this2.state, docId);
|
|
1002
|
+
},
|
|
1003
|
+
canLeave: function canLeave(docId) {
|
|
1004
|
+
return _canLeave(_this2.state, docId);
|
|
1005
|
+
},
|
|
1000
1006
|
canReshare: function canReshare(docId) {
|
|
1001
1007
|
return _canReshare(_this2.state, docId, _instanceUri);
|
|
1002
1008
|
},
|
package/dist/state.js
CHANGED
|
@@ -415,6 +415,21 @@ export var isSharedDrive = function isSharedDrive(state, docId) {
|
|
|
415
415
|
|
|
416
416
|
return false;
|
|
417
417
|
};
|
|
418
|
+
export var isOrgSharedDrive = function isOrgSharedDrive(state, docId) {
|
|
419
|
+
if (state.byDocId[docId] && state.byDocId[docId].sharings.length !== 0) {
|
|
420
|
+
var sharing = getSharingById(state, state.byDocId[docId].sharings[0]);
|
|
421
|
+
return sharing.attributes.drive === true && sharing.attributes.org_drive === true;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return false;
|
|
425
|
+
};
|
|
426
|
+
export var canLeave = function canLeave(state, docId) {
|
|
427
|
+
if (isOrgSharedDrive(state, docId)) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return true;
|
|
432
|
+
};
|
|
418
433
|
export var canReshare = function canReshare(state, docId, instanceUri) {
|
|
419
434
|
var sharing = getDocumentSharing(state, docId);
|
|
420
435
|
var me = sharing.attributes.members.find(matchingInstanceName(instanceUri));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.5.0",
|
|
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": "
|
|
86
|
+
"gitHead": "34a93967119b6820f76f35b01832d1a1627cc58f"
|
|
87
87
|
}
|
package/src/SharingProvider.jsx
CHANGED
|
@@ -28,6 +28,8 @@ import reducer, {
|
|
|
28
28
|
receivePaths,
|
|
29
29
|
isOwner,
|
|
30
30
|
isSharedDrive,
|
|
31
|
+
isOrgSharedDrive,
|
|
32
|
+
canLeave,
|
|
31
33
|
canReshare,
|
|
32
34
|
getOwner,
|
|
33
35
|
getRecipients,
|
|
@@ -66,6 +68,8 @@ export class SharingProvider extends Component {
|
|
|
66
68
|
documentType,
|
|
67
69
|
isOwner: docId => isOwner(this.state, docId),
|
|
68
70
|
isSharedDrive: docId => isSharedDrive(this.state, docId),
|
|
71
|
+
isOrgSharedDrive: docId => isOrgSharedDrive(this.state, docId),
|
|
72
|
+
canLeave: docId => canLeave(this.state, docId),
|
|
69
73
|
canReshare: docId => canReshare(this.state, docId, instanceUri),
|
|
70
74
|
getOwner: docId => getOwner(this.state, docId),
|
|
71
75
|
getSharingType: docId => getSharingType(this.state, docId, instanceUri),
|
package/src/state.js
CHANGED
|
@@ -329,6 +329,24 @@ export const isSharedDrive = (state, docId) => {
|
|
|
329
329
|
return false
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
export const isOrgSharedDrive = (state, docId) => {
|
|
333
|
+
if (state.byDocId[docId] && state.byDocId[docId].sharings.length !== 0) {
|
|
334
|
+
const sharing = getSharingById(state, state.byDocId[docId].sharings[0])
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
sharing.attributes.drive === true && sharing.attributes.org_drive === true
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
return false
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export const canLeave = (state, docId) => {
|
|
344
|
+
if (isOrgSharedDrive(state, docId)) {
|
|
345
|
+
return false
|
|
346
|
+
}
|
|
347
|
+
return true
|
|
348
|
+
}
|
|
349
|
+
|
|
332
350
|
export const canReshare = (state, docId, instanceUri) => {
|
|
333
351
|
const sharing = getDocumentSharing(state, docId)
|
|
334
352
|
const me = sharing.attributes.members.find(matchingInstanceName(instanceUri))
|