diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index c06bff67..6dec1f5f 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -1,12 +1,12 @@ import userChats from './chat' export let users = [ - { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, - { active: false, is_confirmed: true, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, - { active: true, is_confirmed: true, approval_pending: true, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } + { active: true, is_confirmed: true, is_approved: true, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: true, deactivated: false, id: '10', nickname: 'bob', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '567', nickname: 'ded', local: false, external: true, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Person' }, + { active: false, is_confirmed: true, is_approved: true, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }, + { active: true, is_confirmed: true, is_approved: false, deactivated: false, id: '123', nickname: 'bot', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Application' } ] const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false } @@ -104,7 +104,7 @@ export async function deactivateUsers(nicknames, authHost, token) { export async function approveUserAccount(nicknames, authHost, token) { const response = nicknames.map(nickname => { const currentUser = users.find(user => user.nickname === nickname) - return { ...currentUser, approval_pending: false } + return { ...currentUser, is_approved: true } }) return Promise.resolve({ data: response }) } diff --git a/src/store/modules/users.js b/src/store/modules/users.js index a9477323..a1e0f9fe 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -132,7 +132,7 @@ const users = { }, async ApproveUsersAccount({ dispatch, getters }, { users, _userId, _statusId }) { const updatedUsers = users.map(user => { - return { ...user, approval_pending: false } + return { ...user, is_approved: true } }) const nicknames = users.map(user => user.nickname) const callApiFn = async() => await approveUserAccount(nicknames, getters.authHost, getters.token) diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index 64aa75f6..b0edf557 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -46,13 +46,13 @@ {{ $t('users.deleteAccount') }} {{ $t('users.approveAccount') }} {{ $t('users.rejectAccount') }} diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index 8446bbb0..07aaf8ec 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -238,7 +238,7 @@ export default { applyAction(filtered, requirePasswordResetFn) }, approveAccounts: () => { - const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && user.approval_pending) + const filtered = this.selectedUsers.filter(user => this.isLocalUser(user) && !user.is_approved) const approveAccountFn = async(users) => await this.$store.dispatch('ApproveUsersAccount', { users }) applyAction(filtered, approveAccountFn) diff --git a/src/views/users/index.vue b/src/views/users/index.vue index d20161b4..14270e10 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -56,16 +56,16 @@