From 80badf493afca026bc542260f353210e605a1715 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Dec 2021 16:53:00 +0100 Subject: Add mute status in account and channel pages --- shared/extra-utils/users/blocklist-command.ts | 25 ++++++++++++++++++++++++- shared/models/moderation/block-status.model.ts | 15 +++++++++++++++ shared/models/moderation/index.ts | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 shared/models/moderation/block-status.model.ts (limited to 'shared') diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts index 14491a1ae..2e7ed074d 100644 --- a/shared/extra-utils/users/blocklist-command.ts +++ b/shared/extra-utils/users/blocklist-command.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' +import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' import { AbstractCommand, OverrideCommandOptions } from '../shared' type ListBlocklistOptions = OverrideCommandOptions & { @@ -37,6 +37,29 @@ export class BlocklistCommand extends AbstractCommand { // --------------------------------------------------------------------------- + getStatus (options: OverrideCommandOptions & { + accounts?: string[] + hosts?: string[] + }) { + const { accounts, hosts } = options + + const path = '/api/v1/blocklist/status' + + return this.getRequestBody({ + ...options, + + path, + query: { + accounts, + hosts + }, + implicitToken: false, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + } + + // --------------------------------------------------------------------------- + addToMyBlocklist (options: OverrideCommandOptions & { account?: string server?: string diff --git a/shared/models/moderation/block-status.model.ts b/shared/models/moderation/block-status.model.ts new file mode 100644 index 000000000..597312757 --- /dev/null +++ b/shared/models/moderation/block-status.model.ts @@ -0,0 +1,15 @@ +export interface BlockStatus { + accounts: { + [ handle: string ]: { + blockedByServer: boolean + blockedByUser?: boolean + } + } + + hosts: { + [ host: string ]: { + blockedByServer: boolean + blockedByUser?: boolean + } + } +} diff --git a/shared/models/moderation/index.ts b/shared/models/moderation/index.ts index 8b6042e97..f8e6d351c 100644 --- a/shared/models/moderation/index.ts +++ b/shared/models/moderation/index.ts @@ -1,3 +1,4 @@ export * from './abuse' +export * from './block-status.model' export * from './account-block.model' export * from './server-block.model' -- cgit v1.2.3