Fix changing the right of a list shared with a user
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kolaente 2020-02-26 20:34:14 +01:00
parent 57f78ee0d4
commit 8c82c2302f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 9 additions and 10 deletions

View File

@ -76,13 +76,13 @@
</td> </td>
<td class="actions" v-if="userIsAdmin"> <td class="actions" v-if="userIsAdmin">
<div class="select"> <div class="select">
<select @change="sharableID = s.id;toggleType()" v-model="selectedRight" class="button buttonright"> <select @change="toggleType(s)" v-model="selectedRight" class="button buttonright">
<option :value="rights.READ" :selected="s.right === rights.READ">Read only</option> <option :value="rights.READ" :selected="s.right === rights.READ">Read only</option>
<option :value="rights.READ_WRITE" :selected="s.right === rights.READ_WRITE">Read & write</option> <option :value="rights.READ_WRITE" :selected="s.right === rights.READ_WRITE">Read & write</option>
<option :value="rights.ADMIN" :selected="s.right === rights.ADMIN">Admin</option> <option :value="rights.ADMIN" :selected="s.right === rights.ADMIN">Admin</option>
</select> </select>
</div> </div>
<button @click="sharableID = s.id; showDeleteModal = true" class="button is-danger icon-only"> <button @click="() => {sharable = s; showDeleteModal = true}" class="button is-danger icon-only">
<span class="icon is-small"> <span class="icon is-small">
<icon icon="trash-alt"/> <icon icon="trash-alt"/>
</span> </span>
@ -150,8 +150,7 @@
stuffModel: Object, stuffModel: Object,
searchService: Object, searchService: Object,
sharable: Object, sharable: Object,
sharableID: 0, // This holds either user or team id for stuff like rights update or deleting
found: [], found: [],
searchLabel: '', searchLabel: '',
rights: rights, rights: rights,
@ -220,7 +219,7 @@
deleteSharable() { deleteSharable() {
if (this.shareType === 'user') { if (this.shareType === 'user') {
this.stuffModel.userID = this.sharable.id this.stuffModel.userID = this.sharable.username
} else if (this.shareType === 'team') { } else if (this.shareType === 'team') {
this.stuffModel.teamID = this.sharable.id this.stuffModel.teamID = this.sharable.id
} }
@ -265,7 +264,7 @@
this.error(e, this) this.error(e, this)
}) })
}, },
toggleType() { toggleType(sharable) {
if (this.selectedRight !== rights.ADMIN && if (this.selectedRight !== rights.ADMIN &&
this.selectedRight !== rights.READ && this.selectedRight !== rights.READ &&
this.selectedRight !== rights.READ_WRITE this.selectedRight !== rights.READ_WRITE
@ -276,9 +275,9 @@
if (this.shareType === 'user') { if (this.shareType === 'user') {
this.stuffModel.userID = this.sharableID this.stuffModel.userID = sharable.username
} else if (this.shareType === 'team') { } else if (this.shareType === 'team') {
this.stuffModel.teamID = this.sharableID this.stuffModel.teamID = sharable.id
} }
this.stuffService.update(this.stuffModel) this.stuffService.update(this.stuffModel)

View File

@ -9,7 +9,7 @@ export default class UserShareBaseModel extends AbstractModel {
defaults() { defaults() {
return { return {
userID: 0, userID: '',
right: 0, right: 0,
created: null, created: null,

View File

@ -36,6 +36,6 @@
} }
} }
.sharables-list { .sharables-list:not(.card-content) {
overflow-y: auto overflow-y: auto
} }