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 remove: () => this.selectedUsers
.filter(user => this.$store.state.user.id !== user.id) .filter(user => this.$store.state.user.id !== user.id)
.map(user => this.$store.dispatch('DeleteUser', user)), .map(user => this.$store.dispatch('DeleteUser', user)),
addTag: (tag) => () => this.selectedUsers addTag: (tag) => () => {
.filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' const users = this.selectedUsers
? user.local && !user.tags.includes(tag) .filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription'
: !user.tags.includes(tag) ? user.local && !user.tags.includes(tag)
).map(user => this.$store.dispatch('ToggleTag', { user, tag })), : !user.tags.includes(tag))
removeTag: (tag) => () => this.selectedUsers this.$store.dispatch('AddTag', { users, tag })
.filter(user => tag === 'disable_remote_subscription' || tag === 'disable_any_subscription' },
? user.local && user.tags.includes(tag) removeTag: (tag) => () => {
: user.tags.includes(tag) const users = this.selectedUsers
).map(user => this.$store.dispatch('ToggleTag', { user, tag })) .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) { grantRightToMultipleUsers(right) {