Commit 27db721e authored by feld's avatar feld
Browse files

Merge branch 'api/approval_pending' into 'develop'

AdminAPI: change from approval_pending to is_approved

See merge request !192
parents d4c7989f 891ec857
Pipeline #34207 passed with stages
in 10 minutes and 31 seconds
......@@ -18,7 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- *Breaking*: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
- Hide Tag actions on Users tab if MRF TagPolicy is disabled. Add ability to enable TagPolicy from Moderation menu
- Move `:restrict_unauthenticated` settings from Authentication tab to Instance tab
- Replace regular inputs with textareas for setting welcome messages in the Settings section
......
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 })
}
......
......@@ -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)
......
......@@ -46,13 +46,13 @@
{{ $t('users.deleteAccount') }}
</el-dropdown-item>
<el-dropdown-item
v-if="user.local && user.approval_pending"
v-if="user.local && !user.is_approved"
divided
@click.native="handleAccountApproval(user)">
{{ $t('users.approveAccount') }}
</el-dropdown-item>
<el-dropdown-item
v-if="user.local && user.approval_pending"
v-if="user.local && !user.is_approved"
@click.native="handleAccountRejection(user)">
{{ $t('users.rejectAccount') }}
</el-dropdown-item>
......
......@@ -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)
......
......@@ -56,16 +56,16 @@
</el-table-column>
<el-table-column :min-width="width" :label="$t('users.status')">
<template slot-scope="scope">
<el-tag v-if="!scope.row.deactivated & !scope.row.approval_pending" type="success">
<el-tag v-if="!scope.row.deactivated && scope.row.is_approved" type="success">
<span v-if="isDesktop">{{ $t('users.active') }}</span>
<i v-else class="el-icon-circle-check"/>
</el-tag>
<el-tag v-if="scope.row.deactivated & !scope.row.approval_pending" type="danger">
<el-tag v-if="scope.row.deactivated && scope.row.is_approved" type="danger">
<span v-if="isDesktop">{{ $t('users.deactivated') }}</span>
<i v-else class="el-icon-circle-close"/>
</el-tag>
<el-tooltip :content="$t('users.unapprovedAccount')" effect="dark">
<el-tag v-if="scope.row.approval_pending" type="info">
<el-tag v-if="!scope.row.is_approved" type="info">
<span v-if="isDesktop">{{ $t('users.unapproved') }}</span>
<i v-else class="el-icon-warning-outline"/>
</el-tag>
......
......@@ -89,8 +89,8 @@
<tr class="el-table__row">
<td>{{ $t('userProfile.status') }}</td>
<td>
<el-tag v-if="user.approval_pending" type="info">{{ $t('userProfile.pending') }}</el-tag>
<el-tag v-if="!user.deactivated & !user.approval_pending" type="success">{{ $t('userProfile.active') }}</el-tag>
<el-tag v-if="!user.is_approved" type="info">{{ $t('userProfile.pending') }}</el-tag>
<el-tag v-if="!user.deactivated && user.is_approved" type="success">{{ $t('userProfile.active') }}</el-tag>
<el-tag v-if="user.deactivated" type="danger">{{ $t('userProfile.deactivated') }}</el-tag>
</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment