cozy-sharing 26.6.0 → 26.6.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 +6 -0
- package/dist/state.js +2 -21
- package/package.json +2 -2
- package/src/state.js +2 -23
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
|
+
## [26.6.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.6.0...cozy-sharing@26.6.1) (2025-10-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Change the way to check write access of shared drive :bug: ([e75c3ba](https://github.com/cozy/cozy-libs/commit/e75c3ba6ba044639b4ab13021067e15649ecc864))
|
|
11
|
+
|
|
6
12
|
# [26.6.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@26.5.2...cozy-sharing@26.6.0) (2025-10-09)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/dist/state.js
CHANGED
|
@@ -797,22 +797,6 @@ export var getSharedDocIdsBySharings = function getSharedDocIdsBySharings(sharin
|
|
|
797
797
|
});
|
|
798
798
|
return docs;
|
|
799
799
|
};
|
|
800
|
-
/**
|
|
801
|
-
* Resolves shared drive sharing type.
|
|
802
|
-
*
|
|
803
|
-
* @param {object} sharing
|
|
804
|
-
* @returns {'two-way'|'one-way'|null}
|
|
805
|
-
*/
|
|
806
|
-
|
|
807
|
-
var resolveDriveSharingTypeFromRule = function resolveDriveSharingTypeFromRule(sharing) {
|
|
808
|
-
var _sharing$attributes;
|
|
809
|
-
|
|
810
|
-
if (!(sharing !== null && sharing !== void 0 && (_sharing$attributes = sharing.attributes) !== null && _sharing$attributes !== void 0 && (_sharing$attributes = _sharing$attributes.rules) !== null && _sharing$attributes !== void 0 && _sharing$attributes.length)) return null;
|
|
811
|
-
var rule = sharing.attributes.rules[0];
|
|
812
|
-
var dirType = getDirectorySharingType(rule);
|
|
813
|
-
var fileType = getFileSharingType(rule);
|
|
814
|
-
return dirType === SHARING_TYPE.TWO_WAY || fileType === SHARING_TYPE.TWO_WAY ? SHARING_TYPE.TWO_WAY : SHARING_TYPE.ONE_WAY;
|
|
815
|
-
};
|
|
816
800
|
/**
|
|
817
801
|
* Computes the effective sharing type for a drive.
|
|
818
802
|
*
|
|
@@ -822,15 +806,12 @@ var resolveDriveSharingTypeFromRule = function resolveDriveSharingTypeFromRule(s
|
|
|
822
806
|
* @returns {string|null} - the sharing type
|
|
823
807
|
*/
|
|
824
808
|
|
|
825
|
-
|
|
826
809
|
export var getSharedDriveSharingType = function getSharedDriveSharingType(state, driveId, instanceUri) {
|
|
827
810
|
var _sharing$attributes$m;
|
|
828
811
|
|
|
829
812
|
var sharing = getSharingById(state, driveId);
|
|
830
813
|
if (!sharing) return null;
|
|
831
|
-
var baseType = resolveDriveSharingTypeFromRule(sharing);
|
|
832
|
-
if (sharing.attributes.owner) return baseType;
|
|
833
814
|
var me = (_sharing$attributes$m = sharing.attributes.members) === null || _sharing$attributes$m === void 0 ? void 0 : _sharing$attributes$m.find(matchingInstanceName(instanceUri));
|
|
834
|
-
if (!me) return
|
|
835
|
-
return me.read_only ? SHARING_TYPE.ONE_WAY :
|
|
815
|
+
if (!me) return null;
|
|
816
|
+
return me.read_only ? SHARING_TYPE.ONE_WAY : SHARING_TYPE.TWO_WAY;
|
|
836
817
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "26.6.
|
|
3
|
+
"version": "26.6.1",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"sideEffects": [
|
|
80
80
|
"*.css"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "94812ab94b4a3a279eda58ec1e225b4691c904b1"
|
|
83
83
|
}
|
package/src/state.js
CHANGED
|
@@ -677,24 +677,6 @@ export const getSharedDocIdsBySharings = sharings => {
|
|
|
677
677
|
return docs
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
-
/**
|
|
681
|
-
* Resolves shared drive sharing type.
|
|
682
|
-
*
|
|
683
|
-
* @param {object} sharing
|
|
684
|
-
* @returns {'two-way'|'one-way'|null}
|
|
685
|
-
*/
|
|
686
|
-
const resolveDriveSharingTypeFromRule = sharing => {
|
|
687
|
-
if (!sharing?.attributes?.rules?.length) return null
|
|
688
|
-
|
|
689
|
-
const rule = sharing.attributes.rules[0]
|
|
690
|
-
const dirType = getDirectorySharingType(rule)
|
|
691
|
-
const fileType = getFileSharingType(rule)
|
|
692
|
-
|
|
693
|
-
return dirType === SHARING_TYPE.TWO_WAY || fileType === SHARING_TYPE.TWO_WAY
|
|
694
|
-
? SHARING_TYPE.TWO_WAY
|
|
695
|
-
: SHARING_TYPE.ONE_WAY
|
|
696
|
-
}
|
|
697
|
-
|
|
698
680
|
/**
|
|
699
681
|
* Computes the effective sharing type for a drive.
|
|
700
682
|
*
|
|
@@ -707,11 +689,8 @@ export const getSharedDriveSharingType = (state, driveId, instanceUri) => {
|
|
|
707
689
|
const sharing = getSharingById(state, driveId)
|
|
708
690
|
if (!sharing) return null
|
|
709
691
|
|
|
710
|
-
const baseType = resolveDriveSharingTypeFromRule(sharing)
|
|
711
|
-
if (sharing.attributes.owner) return baseType
|
|
712
|
-
|
|
713
692
|
const me = sharing.attributes.members?.find(matchingInstanceName(instanceUri))
|
|
714
|
-
if (!me) return
|
|
693
|
+
if (!me) return null
|
|
715
694
|
|
|
716
|
-
return me.read_only ? SHARING_TYPE.ONE_WAY :
|
|
695
|
+
return me.read_only ? SHARING_TYPE.ONE_WAY : SHARING_TYPE.TWO_WAY
|
|
717
696
|
}
|