Add mute status in account and channel pages

This commit is contained in:
Chocobozzz
2021-12-06 16:53:00 +01:00
parent 33675a4775
commit 80badf493a
28 changed files with 533 additions and 53 deletions

View File

@@ -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<BlockStatus>({
...options,
path,
query: {
accounts,
hosts
},
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
// ---------------------------------------------------------------------------
addToMyBlocklist (options: OverrideCommandOptions & {
account?: string
server?: string

View File

@@ -0,0 +1,15 @@
export interface BlockStatus {
accounts: {
[ handle: string ]: {
blockedByServer: boolean
blockedByUser?: boolean
}
}
hosts: {
[ host: string ]: {
blockedByServer: boolean
blockedByUser?: boolean
}
}
}

View File

@@ -1,3 +1,4 @@
export * from './abuse'
export * from './block-status.model'
export * from './account-block.model'
export * from './server-block.model'