From cc468096398f1f607161415d592b514e965c33a7 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 11 May 2020 20:56:35 +0200 Subject: [PATCH] Fix sharing rights not displayed correctly --- src/components/sharing/userTeam.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/sharing/userTeam.vue b/src/components/sharing/userTeam.vue index fca92bb11..efd907cec 100644 --- a/src/components/sharing/userTeam.vue +++ b/src/components/sharing/userTeam.vue @@ -76,7 +76,7 @@
- @@ -154,7 +154,7 @@ found: [], searchLabel: '', rights: rights, - selectedRight: rights.READ, + selectedRight: {}, typeString: '', sharables: [], // This holds either teams or users who this namepace or list is shared with @@ -213,6 +213,7 @@ this.stuffService.getAll(this.stuffModel) .then(r => { this.$set(this, 'sharables', r) + r.forEach(s => this.$set(this.selectedRight, s.id, s.right)) }) .catch(e => { this.error(e, this) @@ -267,13 +268,13 @@ }) }, toggleType(sharable) { - if (this.selectedRight !== rights.ADMIN && - this.selectedRight !== rights.READ && - this.selectedRight !== rights.READ_WRITE + if (this.selectedRight[sharable.id] !== rights.ADMIN && + this.selectedRight[sharable.id] !== rights.READ && + this.selectedRight[sharable.id] !== rights.READ_WRITE ) { - this.selectedRight = rights.READ + this.selectedRight[sharable.id] = rights.READ } - this.stuffModel.right = this.selectedRight + this.stuffModel.right = this.selectedRight[sharable.id] if (this.shareType === 'user') { @@ -286,7 +287,7 @@ .then(r => { for (const i in this.sharables) { if ( - (this.sharables[i].id === this.stuffModel.userId && this.shareType === 'user') || + (this.sharables[i].username === this.stuffModel.userId && this.shareType === 'user') || (this.sharables[i].id === this.stuffModel.teamId && this.shareType === 'team') ) { this.$set(this.sharables[i], 'right', r.right)