Add ability to change actor type from moderation dropdown

This commit is contained in:
Angelina Filippova 2020-08-22 01:33:40 +03:00
parent a5ab8ceb47
commit a55b76208e
2 changed files with 22 additions and 10 deletions

View file

@ -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 })
}
}
}

View file

@ -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'
}