Skip to content
Snippets Groups Projects
Commit a55b7620 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Add ability to change actor type from moderation dropdown

parent a5ab8ceb
Branches
Tags
1 merge request!161Allow setting actor_type field via Admin API.
......@@ -16,7 +16,8 @@ import {
forcePasswordReset,
approveUserAccount,
confirmUserEmail,
resendConfirmationEmail
resendConfirmationEmail,
updateUserCredentials
} from '@/api/users'
const users = {
......@@ -277,6 +278,15 @@ const users = {
const currentFilters = { ...defaultFilters, ...filters }
commit('SET_USERS_FILTERS', currentFilters)
dispatch('SearchUsers', { query: state.searchQuery, page: 1 })
},
async UpdateActorType({ dispatch, getters }, { user, type, _userId, _statusId }) {
const updatedUsers = [{ ...user, actor_type: type }]
const nickname = [user.nickname]
const credentials = { actor_type: type }
const callApiFn = async() => await updateUserCredentials(nickname, credentials, getters.authHost, getters.token)
dispatch('ApplyChanges', { updatedUsers, callApiFn, userId: _userId, statusId: _statusId })
}
}
}
......
......@@ -17,11 +17,10 @@
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
class="actor-type-dropdown"
@click.native="getPasswordResetToken(user.nickname)">
class="actor-type-dropdown">
<el-select v-model="actorType" placeholder="Actor Type" class="actor-type-select">
<el-option label="Bot" value="bot"/>
<el-option label="Person" value="person"/>
<el-option value="Service"/>
<el-option value="Person"/>
</el-select>
</el-dropdown-item>
<el-dropdown-item
......@@ -146,12 +145,15 @@ export default {
default: ''
}
},
data() {
return {
actorType: ''
}
},
computed: {
actorType: {
get() {
return this.user.actor_type
},
set(type) {
this.$store.dispatch('UpdateActorType', { user: this.user, type })
}
},
isDesktop() {
return this.$store.state.app.device === 'desktop'
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment