Merge branch 'feature/locked-accounts' into 'develop'
Feature/locked accounts See merge request pleroma/pleroma-fe!274
This commit is contained in:
commit
6ea5cfe71e
14 changed files with 135 additions and 13 deletions
|
@ -32,6 +32,9 @@ const USER_URL = '/api/users/show.json'
|
|||
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
||||
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
||||
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
||||
const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests'
|
||||
const APPROVE_USER_URL = '/api/pleroma/friendships/approve'
|
||||
const DENY_USER_URL = '/api/pleroma/friendships/deny'
|
||||
|
||||
import { each, map } from 'lodash'
|
||||
import 'whatwg-fetch'
|
||||
|
@ -127,11 +130,13 @@ const updateBanner = ({credentials, params}) => {
|
|||
const updateProfile = ({credentials, params}) => {
|
||||
let url = PROFILE_UPDATE_URL
|
||||
|
||||
console.log(params)
|
||||
|
||||
const form = new FormData()
|
||||
|
||||
each(params, (value, key) => {
|
||||
if (key === 'description' || /* Always include description, because it might be empty */
|
||||
value) {
|
||||
/* Always include description and locked, because it might be empty or false */
|
||||
if (key === 'description' || key === 'locked' || value) {
|
||||
form.append(key, value)
|
||||
}
|
||||
})
|
||||
|
@ -216,6 +221,22 @@ const unblockUser = ({id, credentials}) => {
|
|||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const approveUser = ({id, credentials}) => {
|
||||
let url = `${APPROVE_USER_URL}?user_id=${id}`
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const denyUser = ({id, credentials}) => {
|
||||
let url = `${DENY_USER_URL}?user_id=${id}`
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const fetchUser = ({id, credentials}) => {
|
||||
let url = `${USER_URL}?user_id=${id}`
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
|
@ -240,6 +261,12 @@ const fetchAllFollowing = ({username, credentials}) => {
|
|||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const fetchFollowRequests = ({credentials}) => {
|
||||
const url = FOLLOW_REQUESTS_URL
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const fetchConversation = ({id, credentials}) => {
|
||||
let url = `${CONVERSATION_URL}/${id}.json?count=100`
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
|
@ -442,7 +469,10 @@ const apiService = {
|
|||
externalProfile,
|
||||
followImport,
|
||||
deleteAccount,
|
||||
changePassword
|
||||
changePassword,
|
||||
fetchFollowRequests,
|
||||
approveUser,
|
||||
denyUser
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue