diff --git a/src/store/modules/users.js b/src/store/modules/users.js
index b2822e86..13d1e378 100644
--- a/src/store/modules/users.js
+++ b/src/store/modules/users.js
@@ -77,16 +77,16 @@ const users = {
}
},
actions: {
- async ActivateUsers({ dispatch, getters }, { users, _userId }) {
+ async ActivateUsers({ dispatch, getters }, { users, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, deactivated: false }
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await activateUsers(nicknames, getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
- async ApplyChanges({ commit, dispatch, state }, { updatedUsers, callApiFn, userId }) {
+ async ApplyChanges({ commit, dispatch, state }, { updatedUsers, callApiFn, userId, statusId }) {
commit('SWAP_USERS', updatedUsers)
try {
@@ -96,29 +96,30 @@ const users = {
} finally {
dispatch('SearchUsers', { query: state.searchQuery, page: state.currentPage })
}
-
- if (userId) {
+ if (statusId) {
+ dispatch('FetchStatus', statusId)
+ } else if (userId) {
dispatch('FetchUserProfile', { userId, godmode: false })
}
dispatch('SuccessMessage')
},
- async AddRight({ dispatch, getters }, { users, right, _userId }) {
+ async AddRight({ dispatch, getters }, { users, right, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return user.local ? { ...user, roles: { ...user.roles, [right]: true }} : user
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await addRight(nicknames, right, getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
- async AddTag({ dispatch, getters }, { users, tag, _userId }) {
+ async AddTag({ dispatch, getters }, { users, tag, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, tags: [...user.tags, tag] }
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await tagUser(nicknames, [tag], getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
async ClearFilters({ commit, dispatch, state }) {
commit('CLEAR_USERS_FILTERS')
@@ -134,23 +135,23 @@ const users = {
}
dispatch('SuccessMessage')
},
- async DeactivateUsers({ dispatch, getters }, { users, _userId }) {
+ async DeactivateUsers({ dispatch, getters }, { users, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, deactivated: true }
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await deactivateUsers(nicknames, getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
- async ConfirmUsersEmail({ dispatch, getters }, { users, _userId }) {
+ async ConfirmUsersEmail({ dispatch, getters }, { users, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, confirmation_pending: false }
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await confirmUserEmail(nicknames, getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
async ResendConfirmationEmail({ dispatch, getters }, users) {
const usersNicknames = users.map(user => user.nickname)
@@ -161,16 +162,16 @@ const users = {
}
dispatch('SuccessMessage')
},
- async DeleteRight({ dispatch, getters }, { users, right, _userId }) {
+ async DeleteRight({ dispatch, getters }, { users, right, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return user.local ? { ...user, roles: { ...user.roles, [right]: false }} : user
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await deleteRight(nicknames, right, getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
- async DeleteUsers({ commit, dispatch, getters, state }, { users, _userId }) {
+ async DeleteUsers({ commit, dispatch, getters, state }, { users, _userId, _statusId }) {
const usersNicknames = users.map(user => user.nickname)
try {
await deleteUsers(usersNicknames, getters.authHost, getters.token)
@@ -181,7 +182,7 @@ const users = {
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id))
commit('SET_USERS', updatedUsers)
- dispatch('FetchUserProfile', { userId: _userId, godmode: false })
+ dispatch('FetchUserProfile', { userId: _userId, statusId: _statusId, godmode: false })
dispatch('SuccessMessage')
},
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
@@ -198,14 +199,14 @@ const users = {
RemovePasswordToken({ commit }) {
commit('SET_PASSWORD_RESET_TOKEN', { link: '', token: '' })
},
- async RemoveTag({ dispatch, getters }, { users, tag, _userId }) {
+ async RemoveTag({ dispatch, getters }, { users, tag, _userId, _statusId }) {
const updatedUsers = users.map(user => {
return { ...user, tags: user.tags.filter(userTag => userTag !== tag) }
})
const nicknames = users.map(user => user.nickname)
const callApiFn = async() => await untagUser(nicknames, [tag], getters.authHost, getters.token)
- dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
+ dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
},
async RequirePasswordReset({ dispatch, getters }, users) {
const nicknames = users.map(user => user.nickname)
diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue
index a893b5d5..33db5cf8 100644
--- a/src/views/users/components/ModerationDropdown.vue
+++ b/src/views/users/components/ModerationDropdown.vue
@@ -5,7 +5,7 @@
{{ $t('users.moderation') }}
-
+
@@ -115,6 +115,10 @@ export default {
page: {
type: String,
default: 'users'
+ },
+ statusId: {
+ type: String,
+ default: ''
}
},
computed: {
@@ -131,10 +135,10 @@ export default {
this.$store.dispatch('ResendConfirmationEmail', [user])
},
handleDeletion(user) {
- this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id })
+ this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
},
handleEmailConfirmation(user) {
- this.$store.dispatch('ConfirmUsersEmail', { users: [user], _userId: user.id })
+ this.$store.dispatch('ConfirmUsersEmail', { users: [user], _userId: user.id, _statusId: this.statusId })
},
requirePasswordReset(user) {
const mailerEnabled = this.$store.state.user.nodeInfo.metadata.mailerEnabled
@@ -152,18 +156,18 @@ export default {
},
toggleActivation(user) {
user.deactivated
- ? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id })
- : this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id })
+ ? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
+ : this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
},
toggleTag(user, tag) {
user.tags.includes(tag)
- ? this.$store.dispatch('RemoveTag', { users: [user], tag, _userId: user.id })
- : this.$store.dispatch('AddTag', { users: [user], tag, _userId: user.id })
+ ? this.$store.dispatch('RemoveTag', { users: [user], tag, _userId: user.id, _statusId: this.statusId })
+ : this.$store.dispatch('AddTag', { users: [user], tag, _userId: user.id, _statusId: this.statusId })
},
toggleUserRight(user, right) {
user.roles[right]
- ? this.$store.dispatch('DeleteRight', { users: [user], right, _userId: user.id })
- : this.$store.dispatch('AddRight', { users: [user], right, _userId: user.id })
+ ? this.$store.dispatch('DeleteRight', { users: [user], right, _userId: user.id, _statusId: this.statusId })
+ : this.$store.dispatch('AddRight', { users: [user], right, _userId: user.id, _statusId: this.statusId })
}
}
}