Merge pull request #519 from pmysl/develop
nicolium: show admin status delete action only on supported backends
This commit is contained in:
@ -1292,7 +1292,7 @@ const MenuButton: React.FC<IMenuButton> = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (!ownAccount) {
|
||||
if (!ownAccount && features.adminDeleteStatus) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.deleteStatus),
|
||||
action: handleDeleteStatus,
|
||||
|
||||
@ -805,24 +805,18 @@ const admin = (client: PlApiBaseClient) => {
|
||||
/**
|
||||
* Delete an individual reported status
|
||||
*
|
||||
* Requires features{@link Features.pleromaAdminStatuses}.
|
||||
* Requires features{@link Features.adminDeleteStatus}.
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#delete-apiv1pleromaadminstatusesid}
|
||||
*/
|
||||
deleteStatus: async (statusId: string) => {
|
||||
let response;
|
||||
|
||||
if (client.features.version.software === MITRA) {
|
||||
response = await client.request<EmptyObject>(`/api/v1/admin/posts/${statusId}`, {
|
||||
const response = await client.request<EmptyObject>(
|
||||
client.features.version.software === MITRA
|
||||
? `/api/v1/admin/posts/${statusId}`
|
||||
: `/api/v1/pleroma/admin/statuses/${statusId}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
});
|
||||
} else {
|
||||
response = await client.request<EmptyObject>(
|
||||
`/api/v1/pleroma/admin/statuses/${statusId}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return response.json;
|
||||
},
|
||||
|
||||
@ -340,6 +340,13 @@ const getFeatures = (instance: Instance) => {
|
||||
*/
|
||||
adminCustomEmojis: v.software === GOTOSOCIAL,
|
||||
|
||||
/**
|
||||
* Ability to delete statuses by admins.
|
||||
* @see DELETE /api/v1/pleroma/admin/statuses/:id
|
||||
* @see DELETE /api/v1/admin/posts/:id
|
||||
*/
|
||||
adminDeleteStatus: any([v.software === AKKOMA, v.software === MITRA, v.software === PLEROMA]),
|
||||
|
||||
/**
|
||||
* Ability to manage instance rules by admins.
|
||||
* @see GET /api/v1/pleroma/admin/rules
|
||||
|
||||
Reference in New Issue
Block a user