forked from AkkomaGang/admin-fe
Remove ability to deactivate account from a status view page
This commit is contained in:
parent
1dfc0bacab
commit
4b701ced5f
2 changed files with 11 additions and 11 deletions
|
@ -77,14 +77,14 @@ const users = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async ActivateUsers({ dispatch, getters }, { users, _userId, _statusId }) {
|
async ActivateUsers({ dispatch, getters }, { users, _userId }) {
|
||||||
const updatedUsers = users.map(user => {
|
const updatedUsers = users.map(user => {
|
||||||
return { ...user, deactivated: false }
|
return { ...user, deactivated: false }
|
||||||
})
|
})
|
||||||
const nicknames = users.map(user => user.nickname)
|
const nicknames = users.map(user => user.nickname)
|
||||||
const callApiFn = async() => await activateUsers(nicknames, getters.authHost, getters.token)
|
const callApiFn = async() => await activateUsers(nicknames, getters.authHost, getters.token)
|
||||||
|
|
||||||
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
|
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
|
||||||
},
|
},
|
||||||
async ApplyChanges({ commit, dispatch, state }, { updatedUsers, callApiFn, userId, statusId }) {
|
async ApplyChanges({ commit, dispatch, state }, { updatedUsers, callApiFn, userId, statusId }) {
|
||||||
commit('SWAP_USERS', updatedUsers)
|
commit('SWAP_USERS', updatedUsers)
|
||||||
|
@ -135,14 +135,14 @@ const users = {
|
||||||
}
|
}
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async DeactivateUsers({ dispatch, getters }, { users, _userId, _statusId }) {
|
async DeactivateUsers({ dispatch, getters }, { users, _userId }) {
|
||||||
const updatedUsers = users.map(user => {
|
const updatedUsers = users.map(user => {
|
||||||
return { ...user, deactivated: true }
|
return { ...user, deactivated: true }
|
||||||
})
|
})
|
||||||
const nicknames = users.map(user => user.nickname)
|
const nicknames = users.map(user => user.nickname)
|
||||||
const callApiFn = async() => await deactivateUsers(nicknames, getters.authHost, getters.token)
|
const callApiFn = async() => await deactivateUsers(nicknames, getters.authHost, getters.token)
|
||||||
|
|
||||||
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
|
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId })
|
||||||
},
|
},
|
||||||
async ConfirmUsersEmail({ dispatch, getters }, { users, _userId, _statusId }) {
|
async ConfirmUsersEmail({ dispatch, getters }, { users, _userId, _statusId }) {
|
||||||
const updatedUsers = users.map(user => {
|
const updatedUsers = users.map(user => {
|
||||||
|
@ -171,7 +171,7 @@ const users = {
|
||||||
|
|
||||||
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
|
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
|
||||||
},
|
},
|
||||||
async DeleteUsers({ commit, dispatch, getters, state }, { users, _userId, _statusId }) {
|
async DeleteUsers({ commit, dispatch, getters, state }, { users, _userId }) {
|
||||||
const usersNicknames = users.map(user => user.nickname)
|
const usersNicknames = users.map(user => user.nickname)
|
||||||
try {
|
try {
|
||||||
await deleteUsers(usersNicknames, getters.authHost, getters.token)
|
await deleteUsers(usersNicknames, getters.authHost, getters.token)
|
||||||
|
@ -182,7 +182,7 @@ const users = {
|
||||||
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id))
|
const updatedUsers = state.fetchedUsers.filter(user => !deletedUsersIds.includes(user.id))
|
||||||
commit('SET_USERS', updatedUsers)
|
commit('SET_USERS', updatedUsers)
|
||||||
|
|
||||||
dispatch('FetchUserProfile', { userId: _userId, statusId: _statusId, godmode: false })
|
dispatch('FetchUserProfile', { userId: _userId, godmode: false })
|
||||||
dispatch('SuccessMessage')
|
dispatch('SuccessMessage')
|
||||||
},
|
},
|
||||||
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
async FetchUsers({ commit, dispatch, getters, state }, { page }) {
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
{{ user.roles.moderator ? $t('users.revokeModerator') : $t('users.grantModerator') }}
|
{{ user.roles.moderator ? $t('users.revokeModerator') : $t('users.grantModerator') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="showDeactivatedButton(user.id)"
|
v-if="showDeactivatedButton(user.id) && page !== 'statusPage'"
|
||||||
:divided="showAdminAction(user)"
|
:divided="showAdminAction(user)"
|
||||||
@click.native="toggleActivation(user)">
|
@click.native="toggleActivation(user)">
|
||||||
{{ user.deactivated ? $t('users.activateAccount') : $t('users.deactivateAccount') }}
|
{{ user.deactivated ? $t('users.activateAccount') : $t('users.deactivateAccount') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="showDeactivatedButton(user.id)"
|
v-if="showDeactivatedButton(user.id) && page !== 'statusPage'"
|
||||||
@click.native="handleDeletion(user)">
|
@click.native="handleDeletion(user)">
|
||||||
{{ $t('users.deleteAccount') }}
|
{{ $t('users.deleteAccount') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
@ -135,7 +135,7 @@ export default {
|
||||||
this.$store.dispatch('ResendConfirmationEmail', [user])
|
this.$store.dispatch('ResendConfirmationEmail', [user])
|
||||||
},
|
},
|
||||||
handleDeletion(user) {
|
handleDeletion(user) {
|
||||||
this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
|
this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id })
|
||||||
},
|
},
|
||||||
handleEmailConfirmation(user) {
|
handleEmailConfirmation(user) {
|
||||||
this.$store.dispatch('ConfirmUsersEmail', { users: [user], _userId: user.id, _statusId: this.statusId })
|
this.$store.dispatch('ConfirmUsersEmail', { users: [user], _userId: user.id, _statusId: this.statusId })
|
||||||
|
@ -156,8 +156,8 @@ export default {
|
||||||
},
|
},
|
||||||
toggleActivation(user) {
|
toggleActivation(user) {
|
||||||
user.deactivated
|
user.deactivated
|
||||||
? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
|
? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id })
|
||||||
: this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id, _statusId: this.statusId })
|
: this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id })
|
||||||
},
|
},
|
||||||
toggleTag(user, tag) {
|
toggleTag(user, tag) {
|
||||||
user.tags.includes(tag)
|
user.tags.includes(tag)
|
||||||
|
|
Loading…
Reference in a new issue