forked from AkkomaGang/akkoma-fe
Fix user activation/deactivation, deletion, and role assignment in the moderation menu
This commit is contained in:
parent
26e455bb4c
commit
695d6b6c50
2 changed files with 9 additions and 9 deletions
|
@ -374,9 +374,9 @@ const users = {
|
||||||
return rootState.api.backendInteractor.unsubscribeUser({ id })
|
return rootState.api.backendInteractor.unsubscribeUser({ id })
|
||||||
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
||||||
},
|
},
|
||||||
toggleActivationStatus ({ rootState, commit }, user) {
|
toggleActivationStatus ({ rootState, commit }, { user }) {
|
||||||
const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser
|
const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser
|
||||||
api(user)
|
api({ user })
|
||||||
.then(({ deactivated }) => commit('updateActivationStatus', { user, deactivated }))
|
.then(({ deactivated }) => commit('updateActivationStatus', { user, deactivated }))
|
||||||
},
|
},
|
||||||
registerPushNotifications (store) {
|
registerPushNotifications (store) {
|
||||||
|
|
|
@ -402,8 +402,8 @@ const fetchStatus = ({ id, credentials }) => {
|
||||||
.then((data) => parseStatus(data))
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagUser = ({ tag, credentials, ...options }) => {
|
const tagUser = ({ tag, credentials, user }) => {
|
||||||
const screenName = options.screen_name
|
const screenName = user.screen_name
|
||||||
const form = {
|
const form = {
|
||||||
nicknames: [screenName],
|
nicknames: [screenName],
|
||||||
tags: [tag]
|
tags: [tag]
|
||||||
|
@ -419,8 +419,8 @@ const tagUser = ({ tag, credentials, ...options }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const untagUser = ({ tag, credentials, ...options }) => {
|
const untagUser = ({ tag, credentials, user }) => {
|
||||||
const screenName = options.screen_name
|
const screenName = user.screen_name
|
||||||
const body = {
|
const body = {
|
||||||
nicknames: [screenName],
|
nicknames: [screenName],
|
||||||
tags: [tag]
|
tags: [tag]
|
||||||
|
@ -436,7 +436,7 @@ const untagUser = ({ tag, credentials, ...options }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const addRight = ({ right, credentials, ...user }) => {
|
const addRight = ({ right, credentials, user }) => {
|
||||||
const screenName = user.screen_name
|
const screenName = user.screen_name
|
||||||
|
|
||||||
return fetch(PERMISSION_GROUP_URL(screenName, right), {
|
return fetch(PERMISSION_GROUP_URL(screenName, right), {
|
||||||
|
@ -446,7 +446,7 @@ const addRight = ({ right, credentials, ...user }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteRight = ({ right, credentials, ...user }) => {
|
const deleteRight = ({ right, credentials, user }) => {
|
||||||
const screenName = user.screen_name
|
const screenName = user.screen_name
|
||||||
|
|
||||||
return fetch(PERMISSION_GROUP_URL(screenName, right), {
|
return fetch(PERMISSION_GROUP_URL(screenName, right), {
|
||||||
|
@ -478,7 +478,7 @@ const deactivateUser = ({ credentials, user: { screen_name: nickname } }) => {
|
||||||
}).then(response => get(response, 'users.0'))
|
}).then(response => get(response, 'users.0'))
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteUser = ({ credentials, ...user }) => {
|
const deleteUser = ({ credentials, user }) => {
|
||||||
const screenName = user.screen_name
|
const screenName = user.screen_name
|
||||||
const headers = authHeaders(credentials)
|
const headers = authHeaders(credentials)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue