Skip to content

Commit

Permalink
fix shareTree loading for resource resharing
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Jun 29, 2022
1 parent 5c71c97 commit 6665a56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ export default {
return this.allowSharePermission && this.resource.canShare()
},
share() {
const userShares = this.sharesTree[this.resource.path]?.filter((s) =>
ShareTypes.containsAnyValue(ShareTypes.individuals, [s.shareType])
)
// FixMe
const userShares = Object.values(this.sharesTree)
.pop()
?.filter((s) => ShareTypes.containsAnyValue(ShareTypes.individuals, [s.shareType]))
return userShares?.length ? userShares[0] : undefined
},
Expand All @@ -171,6 +172,8 @@ export default {
return SpacePeopleShareRoles.list()
}
console.log(this.share)
if (this.resource.isReceivedShare() && this.resourceIsSharable && this.share) {
return PeopleShareRoles.filterByBitmask(
parseInt(this.share.permissions),
Expand Down
10 changes: 1 addition & 9 deletions packages/web-app-files/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export default {
* This will add new entries into the shares tree and will
* not remove unrelated existing ones.
*/
loadSharesTree(context, { client, path, storageId }) {
async loadSharesTree(context, { client, path, storageId }) {
context.commit('SHARESTREE_ERROR', null)
// prune shares tree cache for all unrelated paths, keeping only
// existing relevant parent entries
Expand All @@ -566,15 +566,7 @@ export default {
const parentPaths = getParentPaths(path, true)
const sharesTree = {}

if (!parentPaths.length) {
return Promise.resolve()
}

// remove last entry which is the root folder
parentPaths.pop()

context.commit('SHARESTREE_LOADING', true)

const shareQueriesQueue = new PQueue({ concurrency: 2 })
const shareQueriesPromises = []
parentPaths.forEach((queryPath) => {
Expand Down

0 comments on commit 6665a56

Please sign in to comment.