Update usage of tag/untag api functions for multiple users

This commit is contained in:
Angelina Filippova 2019-05-17 03:27:23 +03:00
parent d3d380a9af
commit d821debd85

View file

@ -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
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)
).map(user => this.$store.dispatch('ToggleTag', { user, tag })),
removeTag: (tag) => () => this.selectedUsers
: !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)
).map(user => this.$store.dispatch('ToggleTag', { user, tag }))
: user.tags.includes(tag))
this.$store.dispatch('RemoveTag', { users, tag })
}
}
},
grantRightToMultipleUsers(right) {