Rename need_approval tag

This commit is contained in:
Angelina Filippova 2020-08-09 01:59:14 +03:00
parent 4fff76a531
commit efee8997f8
4 changed files with 33 additions and 33 deletions

View file

@ -323,7 +323,7 @@ export default {
external: 'External', external: 'External',
byStatus: 'By status', byStatus: 'By status',
active: 'Active', active: 'Active',
pending: 'Pending', pending: 'Pending Approval',
deactivated: 'Deactivated' deactivated: 'Deactivated'
}, },
reports: { reports: {

View file

@ -31,7 +31,7 @@ const users = {
local: false, local: false,
external: false, external: false,
active: false, active: false,
needApproval: false, need_approval: false,
deactivated: false deactivated: false
}, },
passwordResetToken: { passwordResetToken: {
@ -126,14 +126,32 @@ const users = {
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId }) 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 }) { ClearUsersState({ commit }) {
commit('SET_SEARCH_QUERY', '') 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 }) { async ClearFilters({ commit, dispatch, state }) {
commit('CLEAR_USERS_FILTERS') commit('CLEAR_USERS_FILTERS')
dispatch('SearchUsers', { query: state.searchQuery, page: 1 }) 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 }) { async CreateNewAccount({ dispatch, getters, state }, { nickname, email, password }) {
try { try {
await createNewAccount(nickname, email, password, getters.authHost, getters.token) await createNewAccount(nickname, email, password, getters.authHost, getters.token)
@ -161,33 +179,6 @@ const users = {
} }
dispatch('SuccessMessage') 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 }) { async DeleteRight({ dispatch, getters }, { users, right, _userId, _statusId }) {
const updatedUsers = users.map(user => { const updatedUsers = users.map(user => {
return user.local ? { ...user, roles: { ...user.roles, [right]: false }} : user return user.local ? { ...user, roles: { ...user.roles, [right]: false }} : user
@ -246,6 +237,15 @@ const users = {
} }
dispatch('SuccessMessage') 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 }) { async SearchUsers({ commit, dispatch, state, getters }, { query, page }) {
if (query.length === 0) { if (query.length === 0) {
commit('SET_SEARCH_QUERY', query) commit('SET_SEARCH_QUERY', query)
@ -271,7 +271,7 @@ const users = {
local: false, local: false,
external: false, external: false,
active: false, active: false,
needApproval: false, need_approval: false,
deactivated: false deactivated: false
} }
const currentFilters = { ...defaultFilters, ...filters } const currentFilters = { ...defaultFilters, ...filters }

View file

@ -12,7 +12,7 @@
</el-option-group> </el-option-group>
<el-option-group :label="$t('usersFilter.byStatus')"> <el-option-group :label="$t('usersFilter.byStatus')">
<el-option value="active" label="Active">{{ $t('usersFilter.active') }}</el-option> <el-option value="active" label="Active">{{ $t('usersFilter.active') }}</el-option>
<el-option value="needApproval" label="Need Approval">{{ $t('usersFilter.pending') }}</el-option> <el-option value="need_approval" label="Need Approval">{{ $t('usersFilter.pending') }}</el-option>
<el-option value="deactivated" label="Deactivated">{{ $t('usersFilter.deactivated') }}</el-option> <el-option value="deactivated" label="Deactivated">{{ $t('usersFilter.deactivated') }}</el-option>
</el-option-group> </el-option-group>
</el-select> </el-select>

View file

@ -175,7 +175,7 @@ export default {
return this.$store.state.users.totalUsersCount return this.$store.state.users.totalUsersCount
}, },
pendingView() { pendingView() {
return this.$store.state.users.filters['needApproval'] return this.$store.state.users.filters['need_approval']
}, },
width() { width() {
return this.isMobile ? 55 : false return this.isMobile ? 55 : false