From efee8997f8ae5d8c00d168fa0d8774bed4d00dcc Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 9 Aug 2020 01:59:14 +0300 Subject: [PATCH] Rename need_approval tag --- src/lang/en.js | 2 +- src/store/modules/users.js | 60 +++++++++++----------- src/views/users/components/UsersFilter.vue | 2 +- src/views/users/index.vue | 2 +- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index d86a3a1e..f4a9ee73 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -323,7 +323,7 @@ export default { external: 'External', byStatus: 'By status', active: 'Active', - pending: 'Pending', + pending: 'Pending Approval', deactivated: 'Deactivated' }, reports: { diff --git a/src/store/modules/users.js b/src/store/modules/users.js index ccfc10b3..760a4afa 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -31,7 +31,7 @@ const users = { local: false, external: false, active: false, - needApproval: false, + need_approval: false, deactivated: false }, passwordResetToken: { @@ -126,14 +126,32 @@ const users = { dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId }) }, + async ApproveUsersAccount({ dispatch, getters }, { users, _userId, _statusId }) { + const updatedUsers = users.map(user => { + return { ...user, approval_pending: false } + }) + const nicknames = users.map(user => user.nickname) + const callApiFn = async() => await approveUserAccount(nicknames, getters.authHost, getters.token) + + dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId }) + }, ClearUsersState({ commit }) { commit('SET_SEARCH_QUERY', '') - commit('SET_USERS_FILTERS', { local: false, external: false, active: false, needApproval: false, deactivated: false }) + commit('SET_USERS_FILTERS', { local: false, external: false, active: false, need_approval: false, deactivated: false }) }, async ClearFilters({ commit, dispatch, state }) { commit('CLEAR_USERS_FILTERS') dispatch('SearchUsers', { query: state.searchQuery, page: 1 }) }, + 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, statusId: _statusId }) + }, async CreateNewAccount({ dispatch, getters, state }, { nickname, email, password }) { try { await createNewAccount(nickname, email, password, getters.authHost, getters.token) @@ -161,33 +179,6 @@ const users = { } dispatch('SuccessMessage') }, - async ApproveUsersAccount({ dispatch, getters }, { users, _userId, _statusId }) { - const updatedUsers = users.map(user => { - return { ...user, approval_pending: false } - }) - const nicknames = users.map(user => user.nickname) - const callApiFn = async() => await approveUserAccount(nicknames, getters.authHost, getters.token) - - dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId }) - }, - 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, statusId: _statusId }) - }, - async ResendConfirmationEmail({ dispatch, getters }, users) { - const usersNicknames = users.map(user => user.nickname) - try { - await resendConfirmationEmail(usersNicknames, getters.authHost, getters.token) - } catch (_e) { - return - } - dispatch('SuccessMessage') - }, async DeleteRight({ dispatch, getters }, { users, right, _userId, _statusId }) { const updatedUsers = users.map(user => { return user.local ? { ...user, roles: { ...user.roles, [right]: false }} : user @@ -246,6 +237,15 @@ const users = { } dispatch('SuccessMessage') }, + async ResendConfirmationEmail({ dispatch, getters }, users) { + const usersNicknames = users.map(user => user.nickname) + try { + await resendConfirmationEmail(usersNicknames, getters.authHost, getters.token) + } catch (_e) { + return + } + dispatch('SuccessMessage') + }, async SearchUsers({ commit, dispatch, state, getters }, { query, page }) { if (query.length === 0) { commit('SET_SEARCH_QUERY', query) @@ -271,7 +271,7 @@ const users = { local: false, external: false, active: false, - needApproval: false, + need_approval: false, deactivated: false } const currentFilters = { ...defaultFilters, ...filters } diff --git a/src/views/users/components/UsersFilter.vue b/src/views/users/components/UsersFilter.vue index 424b7071..fa5febde 100644 --- a/src/views/users/components/UsersFilter.vue +++ b/src/views/users/components/UsersFilter.vue @@ -12,7 +12,7 @@ {{ $t('usersFilter.active') }} - {{ $t('usersFilter.pending') }} + {{ $t('usersFilter.pending') }} {{ $t('usersFilter.deactivated') }} diff --git a/src/views/users/index.vue b/src/views/users/index.vue index 3831ba80..c3b9bcf6 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -175,7 +175,7 @@ export default { return this.$store.state.users.totalUsersCount }, pendingView() { - return this.$store.state.users.filters['needApproval'] + return this.$store.state.users.filters['need_approval'] }, width() { return this.isMobile ? 55 : false