From b6731bd9af4b2af003ceb59b3dd06220773ff805 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 16 May 2019 13:21:14 -0400
Subject: [PATCH 1/2] update admin api urls in accordance with new docs
---
src/services/api/api.service.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 5f40cfa6..83301bb2 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -14,9 +14,9 @@ const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests'
const APPROVE_USER_URL = '/api/pleroma/friendships/approve'
const DENY_USER_URL = '/api/pleroma/friendships/deny'
const TAG_USER_URL = '/api/pleroma/admin/users/tag'
-const PERMISSION_GROUP_URL = '/api/pleroma/admin/permission_group'
-const ACTIVATION_STATUS_URL = '/api/pleroma/admin/activation_status'
-const ADMIN_USER_URL = '/api/pleroma/admin/user'
+const PERMISSION_GROUP_URL = (nickname, right) => `/api/pleroma/admin/users/${nickname}/permission_group/${right}`
+const ACTIVATION_STATUS_URL = nickname => `/api/pleroma/admin/users/${nickname}/activation_status`
+const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
@@ -399,7 +399,7 @@ const untagUser = ({tag, credentials, ...options}) => {
const addRight = ({right, credentials, ...user}) => {
const screenName = user.screen_name
- return fetch(`${PERMISSION_GROUP_URL}/${screenName}/${right}`, {
+ return fetch(PERMISSION_GROUP_URL(screenName, right), {
method: 'POST',
headers: authHeaders(credentials),
body: {}
@@ -409,7 +409,7 @@ const addRight = ({right, credentials, ...user}) => {
const deleteRight = ({right, credentials, ...user}) => {
const screenName = user.screen_name
- return fetch(`${PERMISSION_GROUP_URL}/${screenName}/${right}`, {
+ return fetch(PERMISSION_GROUP_URL(screenName, right), {
method: 'DELETE',
headers: authHeaders(credentials),
body: {}
@@ -425,7 +425,7 @@ const setActivationStatus = ({status, credentials, ...user}) => {
const headers = authHeaders(credentials)
headers['Content-Type'] = 'application/json'
- return fetch(`${ACTIVATION_STATUS_URL}/${screenName}.json`, {
+ return fetch(ACTIVATION_STATUS_URL(screenName), {
method: 'PUT',
headers: headers,
body: JSON.stringify(body)
@@ -436,7 +436,7 @@ const deleteUser = ({credentials, ...user}) => {
const screenName = user.screen_name
const headers = authHeaders(credentials)
- return fetch(`${ADMIN_USER_URL}.json?nickname=${screenName}`, {
+ return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
method: 'DELETE',
headers: headers
})
From 2457dd9b912f02208b893eb6270e30615405457c Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 16 May 2019 14:02:37 -0400
Subject: [PATCH 2/2] rename for consistency's sake
---
src/services/api/api.service.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 83301bb2..162b62f7 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -14,8 +14,8 @@ const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests'
const APPROVE_USER_URL = '/api/pleroma/friendships/approve'
const DENY_USER_URL = '/api/pleroma/friendships/deny'
const TAG_USER_URL = '/api/pleroma/admin/users/tag'
-const PERMISSION_GROUP_URL = (nickname, right) => `/api/pleroma/admin/users/${nickname}/permission_group/${right}`
-const ACTIVATION_STATUS_URL = nickname => `/api/pleroma/admin/users/${nickname}/activation_status`
+const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}`
+const ACTIVATION_STATUS_URL = screenName => `/api/pleroma/admin/users/${screenName}/activation_status`
const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'