cozy-viewer 13.2.5 → 13.2.6
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 +11 -0
- package/dist/ViewerContainer.js +4 -3
- package/package.json +3 -3
- package/src/ViewerContainer.jsx +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [13.2.6](https://github.com/cozy/cozy-libs/compare/cozy-viewer@13.2.5...cozy-viewer@13.2.6) (2025-01-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Viewer:** Now wait all sharing fetch before checking write access ([3657ac3](https://github.com/cozy/cozy-libs/commit/3657ac3b3243abef7b70ebd5fe16d183646ec085))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [13.2.5](https://github.com/cozy/cozy-libs/compare/cozy-viewer@13.2.4...cozy-viewer@13.2.5) (2025-01-21)
|
|
7
18
|
|
|
8
19
|
|
package/dist/ViewerContainer.js
CHANGED
|
@@ -95,7 +95,8 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
95
95
|
|
|
96
96
|
var _useSharingContext = (0, _cozySharing.useSharingContext)(),
|
|
97
97
|
hasWriteAccess = _useSharingContext.hasWriteAccess,
|
|
98
|
-
hasSharedParent = _useSharingContext.hasSharedParent
|
|
98
|
+
hasSharedParent = _useSharingContext.hasSharedParent,
|
|
99
|
+
allLoaded = _useSharingContext.allLoaded;
|
|
99
100
|
|
|
100
101
|
var currentFile = files[currentIndex];
|
|
101
102
|
var fileCount = files.length;
|
|
@@ -134,7 +135,7 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
134
135
|
break;
|
|
135
136
|
|
|
136
137
|
case 6:
|
|
137
|
-
_context.t0 = !hasWriteAccess(hasSharedParent(currentFile.path) ? currentFile.dir_id : currentFile._id);
|
|
138
|
+
_context.t0 = allLoaded ? !hasWriteAccess(hasSharedParent(currentFile.path) ? currentFile.dir_id : currentFile._id) : true;
|
|
138
139
|
|
|
139
140
|
case 7:
|
|
140
141
|
res = _context.t0;
|
|
@@ -153,7 +154,7 @@ var ViewerContainer = function ViewerContainer(props) {
|
|
|
153
154
|
}();
|
|
154
155
|
|
|
155
156
|
getIsReadOnly();
|
|
156
|
-
}, [client, currentFile, hasWriteAccess, hasSharedParent, isPublic]);
|
|
157
|
+
}, [client, currentFile, hasWriteAccess, hasSharedParent, allLoaded, isPublic]);
|
|
157
158
|
return /*#__PURE__*/_react.default.createElement(_Alert.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
159
|
id: "viewer-wrapper",
|
|
159
160
|
className: (0, _classnames.default)(styles['viewer-wrapper'], className)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-viewer",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.6",
|
|
4
4
|
"description": "Cozy-Viewer provides a component to show files in a viewer.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"babel-preset-cozy-app": "^2.8.1",
|
|
28
28
|
"cozy-client": "^52.1.0",
|
|
29
29
|
"cozy-device-helper": "2.0.0",
|
|
30
|
-
"cozy-harvest-lib": "^32.2.
|
|
30
|
+
"cozy-harvest-lib": "^32.2.16",
|
|
31
31
|
"cozy-intent": "^2.29.1",
|
|
32
32
|
"cozy-logger": "^1.16.1",
|
|
33
33
|
"cozy-sharing": "^19.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": ">=16.12.0",
|
|
60
60
|
"react-dom": ">=16.12.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "3fc2e4bd5776c7094fc9b8a5288b68e9e1cf054e"
|
|
63
63
|
}
|
package/src/ViewerContainer.jsx
CHANGED
|
@@ -35,7 +35,7 @@ const ViewerContainer = props => {
|
|
|
35
35
|
const [isReadOnly, setIsReadOnly] = useState(true)
|
|
36
36
|
const client = useClient()
|
|
37
37
|
useExtendI18n(locales)
|
|
38
|
-
const { hasWriteAccess, hasSharedParent } = useSharingContext()
|
|
38
|
+
const { hasWriteAccess, hasSharedParent, allLoaded } = useSharingContext()
|
|
39
39
|
|
|
40
40
|
const currentFile = files[currentIndex]
|
|
41
41
|
const fileCount = files.length
|
|
@@ -59,17 +59,26 @@ const ViewerContainer = props => {
|
|
|
59
59
|
document: currentFile,
|
|
60
60
|
client
|
|
61
61
|
})
|
|
62
|
-
:
|
|
62
|
+
: allLoaded
|
|
63
|
+
? !hasWriteAccess(
|
|
63
64
|
hasSharedParent(currentFile.path)
|
|
64
65
|
? currentFile.dir_id
|
|
65
66
|
: currentFile._id
|
|
66
67
|
)
|
|
68
|
+
: true
|
|
67
69
|
|
|
68
70
|
setIsReadOnly(res)
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
getIsReadOnly()
|
|
72
|
-
}, [
|
|
74
|
+
}, [
|
|
75
|
+
client,
|
|
76
|
+
currentFile,
|
|
77
|
+
hasWriteAccess,
|
|
78
|
+
hasSharedParent,
|
|
79
|
+
allLoaded,
|
|
80
|
+
isPublic
|
|
81
|
+
])
|
|
73
82
|
|
|
74
83
|
return (
|
|
75
84
|
<AlertProvider>
|