fix admin application of verification/suggestion
This commit is contained in:
@ -390,11 +390,11 @@ const admin = (client: PlApiBaseClient) => {
|
||||
method: 'POST',
|
||||
});
|
||||
} else {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
response = await client.request('/api/v1/pleroma/admin/users/activate', {
|
||||
method: 'PATCH',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
});
|
||||
response.json = response.json?.users?.[0];
|
||||
}
|
||||
@ -419,20 +419,20 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* Requires features{@link Features.pleromaAdminAccounts}.
|
||||
*/
|
||||
promoteToAdmin: async (accountId: string) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/permission_group/moderator',
|
||||
{
|
||||
method: 'DELETE',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
const response = await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/permission_group/admin',
|
||||
{
|
||||
method: 'POST',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
|
||||
@ -443,17 +443,17 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* Requires features{@link Features.pleromaAdminAccounts}.
|
||||
*/
|
||||
promoteToModerator: async (accountId: string) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
await client.request<EmptyObject>('/api/v1/pleroma/admin/users/permission_group/admin', {
|
||||
method: 'DELETE',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
});
|
||||
const response = await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/permission_group/moderator',
|
||||
{
|
||||
method: 'POST',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
|
||||
@ -464,20 +464,20 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* Requires features{@link Features.pleromaAdminAccounts}.
|
||||
*/
|
||||
demoteToUser: async (accountId: string) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/permission_group/moderator',
|
||||
{
|
||||
method: 'DELETE',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
const response = await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/permission_group/admin',
|
||||
{
|
||||
method: 'DELETE',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
|
||||
@ -491,11 +491,11 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#patch-apiv1pleromaadminuserssuggest}
|
||||
*/
|
||||
suggestUser: async (accountId: string) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
const response = await client.request<EmptyObject>('/api/v1/pleroma/admin/users/suggest', {
|
||||
method: 'PATCH',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
});
|
||||
|
||||
return response.json;
|
||||
@ -508,13 +508,13 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#patch-apiv1pleromaadminusersunsuggest}
|
||||
*/
|
||||
unsuggestUser: async (accountId: string) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
const response = await client.request<EmptyObject>(
|
||||
'/api/v1/pleroma/admin/users/unsuggest',
|
||||
{
|
||||
method: 'PATCH',
|
||||
body: { nicknames: [account!.acct] },
|
||||
body: { nicknames: [adminAccount.username] },
|
||||
},
|
||||
);
|
||||
|
||||
@ -528,11 +528,11 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#put-apiv1pleromaadminuserstag}
|
||||
*/
|
||||
tagUser: async (accountId: string, tags: Array<string>) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
const response = await client.request<EmptyObject>('/api/v1/pleroma/admin/users/tag', {
|
||||
method: 'PUT',
|
||||
body: { nicknames: [account!.acct], tags },
|
||||
body: { nicknames: [adminAccount.username], tags },
|
||||
});
|
||||
|
||||
return response.json;
|
||||
@ -545,11 +545,11 @@ const admin = (client: PlApiBaseClient) => {
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#delete-apiv1pleromaadminuserstag}
|
||||
*/
|
||||
untagUser: async (accountId: string, tags: Array<string>) => {
|
||||
const { account } = await category.accounts.getAccount(accountId)!;
|
||||
const adminAccount = await category.accounts.getAccount(accountId)!;
|
||||
|
||||
const response = await client.request<EmptyObject>('/api/v1/pleroma/admin/users/tag', {
|
||||
method: 'DELETE',
|
||||
body: { nicknames: [account!.acct], tags },
|
||||
body: { nicknames: [adminAccount.username], tags },
|
||||
});
|
||||
|
||||
return response.json;
|
||||
|
||||
Reference in New Issue
Block a user