From d821debd853811f33b7bfb75fcb1d8ba04d545bf Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 17 May 2019 03:27:23 +0300 Subject: [PATCH] Update usage of tag/untag api functions for multiple users --- src/views/users/components/DropdownMenu.vue | 24 ++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/views/users/components/DropdownMenu.vue b/src/views/users/components/DropdownMenu.vue index 4edda779..644b1bb8 100644 --- a/src/views/users/components/DropdownMenu.vue +++ b/src/views/users/components/DropdownMenu.vue @@ -130,16 +130,20 @@ export default { remove: () => this.selectedUsers .filter(user => this.$store.state.user.id !== user.id) .map(user => this.$store.dispatch('DeleteUser', user)), - addTag: (tag) => () => this.selectedUsers - .filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' - ? user.local && !user.tags.includes(tag) - : !user.tags.includes(tag) - ).map(user => this.$store.dispatch('ToggleTag', { user, tag })), - removeTag: (tag) => () => this.selectedUsers - .filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' - ? user.local && user.tags.includes(tag) - : user.tags.includes(tag) - ).map(user => this.$store.dispatch('ToggleTag', { user, tag })) + addTag: (tag) => () => { + const users = this.selectedUsers + .filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' + ? user.local && !user.tags.includes(tag) + : !user.tags.includes(tag)) + this.$store.dispatch('AddTag', { users, tag }) + }, + removeTag: (tag) => () => { + const users = this.selectedUsers + .filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' + ? user.local && user.tags.includes(tag) + : user.tags.includes(tag)) + this.$store.dispatch('RemoveTag', { users, tag }) + } } }, grantRightToMultipleUsers(right) {