Show actor type on user show page and manage it from that page

This commit is contained in:
Angelina Filippova 2020-08-22 03:04:16 +03:00
parent a55b76208e
commit d8b3e9e9df
4 changed files with 25 additions and 9 deletions

View file

@ -271,7 +271,9 @@ export default {
invalidNickname: 'invalid nickname', invalidNickname: 'invalid nickname',
passwordResetTokenGenerated: 'Password reset token was generated:', passwordResetTokenGenerated: 'Password reset token was generated:',
linkToResetPassword: 'You can also use this link to reset password:', linkToResetPassword: 'You can also use this link to reset password:',
registrationReason: 'Registration Reason' registrationReason: 'Registration Reason',
service: 'Service',
person: 'Person'
}, },
statuses: { statuses: {
statuses: 'Statuses', statuses: 'Statuses',
@ -292,7 +294,8 @@ export default {
admin: 'Admin', admin: 'Admin',
local: 'Local', local: 'Local',
external: 'External', external: 'External',
accountType: 'Account type', accountType: 'Account Type',
actorType: 'Actor Type',
nickname: 'Nickname', nickname: 'Nickname',
recentStatuses: 'Recent Statuses', recentStatuses: 'Recent Statuses',
roles: 'Roles', roles: 'Roles',

View file

@ -281,10 +281,9 @@ const users = {
}, },
async UpdateActorType({ dispatch, getters }, { user, type, _userId, _statusId }) { async UpdateActorType({ dispatch, getters }, { user, type, _userId, _statusId }) {
const updatedUsers = [{ ...user, actor_type: type }] const updatedUsers = [{ ...user, actor_type: type }]
const nickname = [user.nickname]
const credentials = { actor_type: type } const credentials = { actor_type: type }
const callApiFn = async() => await updateUserCredentials(nickname, credentials, getters.authHost, getters.token) const callApiFn = async() => await updateUserCredentials(user.nickname, credentials, getters.authHost, getters.token)
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId }) dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
} }

View file

@ -18,9 +18,9 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item
class="actor-type-dropdown"> class="actor-type-dropdown">
<el-select v-model="actorType" placeholder="Actor Type" class="actor-type-select"> <el-select v-model="actorType" :placeholder="$t('userProfile.actorType')" class="actor-type-select">
<el-option value="Service"/> <el-option :label="$t('users.service')" value="Service"/>
<el-option value="Person"/> <el-option :label="$t('users.person')" value="Person"/>
</el-select> </el-select>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
@ -151,7 +151,12 @@ export default {
return this.user.actor_type return this.user.actor_type
}, },
set(type) { set(type) {
this.$store.dispatch('UpdateActorType', { user: this.user, type }) this.$store.dispatch('UpdateActorType', {
user: this.user,
type,
_userId: this.user.id,
_statusId: this.statusId
})
} }
}, },
isDesktop() { isDesktop() {

View file

@ -46,10 +46,19 @@
<tbody> <tbody>
<tr class="el-table__row"> <tr class="el-table__row">
<td class="name-col">ID</td> <td class="name-col">ID</td>
<td class="value-col"> <td>
{{ user.id }} {{ user.id }}
</td> </td>
</tr> </tr>
<tr class="el-table__row">
<td>{{ $t('userProfile.actorType') }}</td>
<td>
<el-tag
:type="userCredentials.actor_type === 'Person' ? 'success' : 'warning'">
{{ userCredentials.actor_type }}
</el-tag>
</td>
</tr>
<tr class="el-table__row"> <tr class="el-table__row">
<td>{{ $t('userProfile.tags') }}</td> <td>{{ $t('userProfile.tags') }}</td>
<td> <td>