Skip to content

Commit

Permalink
fix: Paginated permission were not normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Nov 9, 2022
1 parent c401270 commit eac18f4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 39 deletions.
4 changes: 2 additions & 2 deletions packages/cozy-sharing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"babel-jest": "26.6.3",
"babel-plugin-css-modules-transform": "1.6.2",
"babel-plugin-inline-react-svg": "1.1.2",
"cozy-client": "23.19.1",
"cozy-client": "34.1.0",
"cozy-ui": "62.1.2",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.6",
Expand All @@ -53,7 +53,7 @@
},
"peerDependencies": {
"@material-ui/core": "4",
"cozy-client": "^16",
"cozy-client": "^34.1.0",
"cozy-realtime": "^3.11.0",
"cozy-ui": "^45.1.0",
"prop-types": "^15.7.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-sharing/src/SharingProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class SharingProvider extends Component {
)
this.setState({ hasLoadedAtLeastOnePage: true })
// eslint-disable-next-line promise/catch-or-return
fetchNextPermissions(permissions, this.dispatch, client).then(() =>
fetchNextPermissions(permissions, this.dispatch, this.permissionCol).then(
this.setState({ allLoaded: true })
)
if (doctype !== 'io.cozy.files') return
Expand Down
12 changes: 7 additions & 5 deletions packages/cozy-sharing/src/fetchNextPermissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { addSharingLink } from './state'
* @param {Function} dispatch
* @param {Object} client
*/
export const fetchNextPermissions = async (permissions, dispatch, client) => {
export const fetchNextPermissions = async (
permissions,
dispatch,
permissionCol
) => {
if (permissions.links && permissions.links.next) {
const resp = await client
.getStackClient()
.fetchJSON('GET', permissions.links.next)
const resp = await permissionCol.fetchPermissionsByLink(permissions)
dispatch(addSharingLink(resp.data))
return fetchNextPermissions(resp, dispatch, client)
return fetchNextPermissions(resp, dispatch, permissionCol)
}
}
59 changes: 28 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6824,10 +6824,10 @@ cozy-client@16.19.0:
sift "^6.0.0"
url-search-params-polyfill "^7.0.0"

cozy-client@23.19.1:
version "23.19.1"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-23.19.1.tgz#94d3ba189b00fc0ce192060f3b1a5107cb4e2783"
integrity sha512-tdu+3840xilc5cvn/CTf1OKrAq1gUzSGRCpue+AF5F2M/jdSE3NxThA6vE9OpTV9MEhazAYWvzrVshqljpUh+Q==
cozy-client@27.17.0:
version "27.17.0"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-27.17.0.tgz#029945f50dd13bae317edcf234f65240675bcd0e"
integrity sha512-IkWSSTeYsehRS25lOLDACLomwl+QAwr+TkkCgnzZfvWCQhpJ0MUYrMQPI3IAhAIZPMgwphqUT7t+SMDCYemfAg==
dependencies:
"@cozy/minilog" "1.0.0"
"@types/jest" "^26.0.20"
Expand All @@ -6836,33 +6836,31 @@ cozy-client@23.19.1:
cozy-device-helper "^1.12.0"
cozy-flags "2.7.1"
cozy-logger "^1.6.0"
cozy-stack-client "^23.19.0"
cozy-stack-client "^27.17.0"
json-stable-stringify "^1.0.1"
lodash "^4.17.13"
microee "^0.0.6"
node-fetch "^2.6.1"
open "^7.0.2"
node-polyglot "2.4.2"
open "7.4.2"
prop-types "^15.6.2"
react-redux "^7.2.0"
redux "3 || 4"
redux-thunk "^2.3.0"
server-destroy "^1.0.1"
sift "^6.0.0"
url-search-params-polyfill "^7.0.0"
url-search-params-polyfill "^8.0.0"

cozy-client@27.17.0:
version "27.17.0"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-27.17.0.tgz#029945f50dd13bae317edcf234f65240675bcd0e"
integrity sha512-IkWSSTeYsehRS25lOLDACLomwl+QAwr+TkkCgnzZfvWCQhpJ0MUYrMQPI3IAhAIZPMgwphqUT7t+SMDCYemfAg==
cozy-client@34.1.0:
version "34.1.0"
resolved "https://registry.yarnpkg.com/cozy-client/-/cozy-client-34.1.0.tgz#5528b67f941cbb434459dca75a1d157d9d7ef2ab"
integrity sha512-2F6c7Y6cnrfDHdh9EIz13g0ylO2vaTKQslhbiUZWxQbWTlnEqgRqcFgtn3hYfi4VOeTW1gBT9HnJxcM+kVVYjg==
dependencies:
"@cozy/minilog" "1.0.0"
"@types/jest" "^26.0.20"
"@types/lodash" "^4.14.170"
btoa "^1.2.1"
cozy-device-helper "^1.12.0"
cozy-flags "2.7.1"
cozy-logger "^1.6.0"
cozy-stack-client "^27.17.0"
cozy-stack-client "^34.1.0"
json-stable-stringify "^1.0.1"
lodash "^4.17.13"
microee "^0.0.6"
Expand Down Expand Up @@ -7020,16 +7018,6 @@ cozy-stack-client@^16.19.0:
mime "^2.4.0"
qs "^6.7.0"

cozy-stack-client@^23.19.0:
version "23.19.0"
resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-23.19.0.tgz#2972c3dcc151b13c0f65749f341a6349170fe1d3"
integrity sha512-oq7/ERKy/Gg3jnxSi0rs3upvBccsGmmfdMiIa9hhJcw/Vxl7NMmjUM2itPnfmBNAMfBax6VlB8HWI1LY87fLuw==
dependencies:
cozy-flags "2.7.1"
detect-node "^2.0.4"
mime "^2.4.0"
qs "^6.7.0"

cozy-stack-client@^27.17.0:
version "27.19.4"
resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-27.19.4.tgz#3d27b4b9b2528e564ba7c82465288500d6e2d713"
Expand Down Expand Up @@ -7058,6 +7046,15 @@ cozy-stack-client@^33.0.8:
mime "^2.4.0"
qs "^6.7.0"

cozy-stack-client@^34.1.0:
version "34.1.0"
resolved "https://registry.yarnpkg.com/cozy-stack-client/-/cozy-stack-client-34.1.0.tgz#2ff134ad3717947c669e49489da3bd1dedae12d0"
integrity sha512-Xg5yqtJTpJtxLVEHJbtrEdIpA/yNePHI4k9jFkoHII72Rb/sW71aWihQHuOhm+7fKyYDeV5hi7cHg82BB6+cAQ==
dependencies:
detect-node "^2.0.4"
mime "^2.4.0"
qs "^6.7.0"

cozy-ui@35.22.0:
version "35.22.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-35.22.0.tgz#ce8e1703740a27073b3cff812f9a7027d3a27e41"
Expand Down Expand Up @@ -14640,19 +14637,19 @@ msgpack5@^4.0.2:
readable-stream "^2.3.6"
safe-buffer "^5.1.2"

"mui-bottom-sheet@git+https://github.com/cozy/mui-bottom-sheet.git#v1.0.9":
version "1.0.8"
resolved "git+https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c"
"mui-bottom-sheet@https://github.com/cozy/mui-bottom-sheet.git#v1.0.6":
version "1.0.6"
resolved "https://github.com/cozy/mui-bottom-sheet.git#494c40416ecde95732c864f9b921e7e545075aa5"
dependencies:
"@juggle/resize-observer" "^3.1.3"
jest-environment-jsdom-sixteen "^1.0.3"
react-spring "9.0.0-rc.3"
react-use-gesture "^7.0.8"
react-use-measure "^2.0.0"

"mui-bottom-sheet@https://github.com/cozy/mui-bottom-sheet.git#v1.0.6":
version "1.0.6"
resolved "https://github.com/cozy/mui-bottom-sheet.git#494c40416ecde95732c864f9b921e7e545075aa5"
"mui-bottom-sheet@https://github.com/cozy/mui-bottom-sheet.git#v1.0.9":
version "1.0.8"
resolved "https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c"
dependencies:
"@juggle/resize-observer" "^3.1.3"
jest-environment-jsdom-sixteen "^1.0.3"
Expand Down

0 comments on commit eac18f4

Please sign in to comment.