Commit 4e4c4af4 authored by Tae Hoon's avatar Tae Hoon

toggle_activation api is also deprecated

parent 36376ce5
Pipeline #21212 passed with stages
in 4 minutes and 29 seconds
...@@ -332,10 +332,9 @@ const users = { ...@@ -332,10 +332,9 @@ const users = {
.then((relationship) => commit('updateUserRelationship', [relationship])) .then((relationship) => commit('updateUserRelationship', [relationship]))
}, },
toggleActivationStatus ({ rootState, commit }, user) { toggleActivationStatus ({ rootState, commit }, user) {
rootState.api.backendInteractor.toggleActivationStatus(user) const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser
.then(response => { api(user)
commit('updateActivationStatus', { user, deactivated: response.deactivated }) .then(({ deactivated }) => commit('updateActivationStatus', { user, deactivated }))
})
}, },
registerPushNotifications (store) { registerPushNotifications (store) {
const token = store.state.currentUser.credentials const token = store.state.currentUser.credentials
......
import { each, map, concat, last } from 'lodash' import { each, map, concat, last, get } from 'lodash'
import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js'
import 'whatwg-fetch' import 'whatwg-fetch'
import { RegistrationError, StatusCodeError } from '../errors/errors' import { RegistrationError, StatusCodeError } from '../errors/errors'
...@@ -12,7 +12,8 @@ const CHANGE_EMAIL_URL = '/api/pleroma/change_email' ...@@ -12,7 +12,8 @@ const CHANGE_EMAIL_URL = '/api/pleroma/change_email'
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
const TAG_USER_URL = '/api/pleroma/admin/users/tag' const TAG_USER_URL = '/api/pleroma/admin/users/tag'
const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}` const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}`
const TOGGLE_ACTIVATION_URL = screenName => `/api/pleroma/admin/users/${screenName}/toggle_activation` const ACTIVATE_USER_URL = '/api/pleroma/admin/users/activate'
const DEACTIVATE_USER_URL = '/api/pleroma/admin/users/deactivate'
const ADMIN_USERS_URL = '/api/pleroma/admin/users' const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions' const SUGGESTIONS_URL = '/api/v1/suggestions'
const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings' const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings'
...@@ -450,9 +451,26 @@ const deleteRight = ({ right, credentials, ...user }) => { ...@@ -450,9 +451,26 @@ const deleteRight = ({ right, credentials, ...user }) => {
}) })
} }
// eslint-disable-next-line camelcase const activateUser = ({ credentials, screen_name: nickname }) => {
const toggleActivationStatus = ({ credentials, screen_name }) => { return promisedRequest({
return promisedRequest({ url: TOGGLE_ACTIVATION_URL(screen_name), method: 'PATCH', credentials }) url: ACTIVATE_USER_URL,
method: 'PATCH',
credentials,
payload: {
nicknames: [nickname]
}
}).then(response => get(response, 'users.0'))
}
const deactivateUser = ({ credentials, screen_name: nickname }) => {
return promisedRequest({
url: DEACTIVATE_USER_URL,
method: 'PATCH',
credentials,
payload: {
nicknames: [nickname]
}
}).then(response => get(response, 'users.0'))
} }
const deleteUser = ({ credentials, ...user }) => { const deleteUser = ({ credentials, ...user }) => {
...@@ -968,7 +986,8 @@ const apiService = { ...@@ -968,7 +986,8 @@ const apiService = {
deleteUser, deleteUser,
addRight, addRight,
deleteRight, deleteRight,
toggleActivationStatus, activateUser,
deactivateUser,
register, register,
getCaptcha, getCaptcha,
updateAvatar, updateAvatar,
......
...@@ -89,8 +89,13 @@ const backendInteractorService = credentials => { ...@@ -89,8 +89,13 @@ const backendInteractorService = credentials => {
} }
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const toggleActivationStatus = ({ screen_name }) => { const activateUser = ({ screen_name }) => {
return apiService.toggleActivationStatus({ screen_name, credentials }) return apiService.activateUser({ screen_name, credentials })
}
// eslint-disable-next-line camelcase
const deactivateUser = ({ screen_name }) => {
return apiService.deactivateUser({ screen_name, credentials })
} }
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
...@@ -191,7 +196,8 @@ const backendInteractorService = credentials => { ...@@ -191,7 +196,8 @@ const backendInteractorService = credentials => {
addRight, addRight,
deleteRight, deleteRight,
deleteUser, deleteUser,
toggleActivationStatus, activateUser,
deactivateUser,
register, register,
getCaptcha, getCaptcha,
updateAvatar, updateAvatar,
......
Markdown is supported
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