Skip to content

Commit

Permalink
feat: Add sensitized flag to AdminAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Apr 8, 2023
1 parent d68c2c6 commit 18e2221
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/mastodon/v1/entities/admin/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface Account {
silenced: boolean;
/** Whether the account is currently suspended. */
suspended: boolean;
/** Boolean. Filter for accounts force-marked as sensitive? */
sensitized: boolean;
/** User-level information about the account. */
account: PublicAccount;
/** The ID of the application that created this account. */
Expand Down
22 changes: 18 additions & 4 deletions src/mastodon/v1/repositories/admin/account-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { version } from '../../../../decorators';
import type { Http } from '../../../../http';
import type { Logger } from '../../../../logger';
import { Paginator } from '../../../../paginator';
import type { Repository } from '../../../repository';
import type { DefaultPaginationParams, Repository } from '../../../repository';
import type { Admin } from '../../entities';

export interface ListAccountsParams {
export interface ListAccountsParams extends DefaultPaginationParams {
/** Filter for local accounts? */
readonly local?: boolean | null;
/** Filter for remote accounts? */
Expand All @@ -23,6 +23,8 @@ export interface ListAccountsParams {
readonly silenced?: boolean | null;
/** Filter for currently suspended accounts? */
readonly suspended?: boolean | null;
/** Boolean. Filter for accounts force-marked as sensitive? */
readonly sensitized?: boolean | null;
/** Username to search for */
readonly username?: string | null;
/** Display name to search for */
Expand All @@ -40,6 +42,7 @@ export type AccountActionType =
| 'none'
| 'disable'
| 'silence'
| 'sensitive'
| 'suspend';

export interface CreateActionParams {
Expand Down Expand Up @@ -94,10 +97,10 @@ export class AccountRepository
* @param id g ID of the account
* @param params Params
* @return Account
* @see https://docs.joinmastodon.org/methods/admin/
* @see https://docs.joinmastodon.org/methods/admin/accounts/#action
*/
@version({ since: '2.9.1' })
createAction(id: string, params: CreateActionParams): Promise<Admin.Account> {
createAction(id: string, params: CreateActionParams): Promise<void> {
return this.http.post(`/api/v1/admin/accounts/${id}/action`, params);
}

Expand Down Expand Up @@ -155,4 +158,15 @@ export class AccountRepository
unsuspend(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/unsuspend`);
}

/**
* Unmark an account as sensitive
* @param id ID of the account
* @return AdminAccount
* @see https://docs.joinmastodon.org/methods/admin/accounts/#unsensitive
*/
@version({ since: '2.9.1' })
unsensitive(id: string): Promise<Admin.Account> {
return this.http.post(`/api/v1/admin/accounts/${id}/unsensitive`);
}
}

0 comments on commit 18e2221

Please sign in to comment.