X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-moderation%2Faccount-blocklist.component.ts;h=9ed00bc12f211c0cad3d4a7f560f9588c5284629;hb=77239b425a8e00822a53c9907415832a473c3eb6;hp=11e5549789368fc53eae06105be11ca784173a6f;hpb=583eb04b541175035d6d452ca626a96ebf2b7437;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts index 11e554978..9ed00bc12 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts @@ -1,14 +1,13 @@ import { SortMeta } from 'primeng/api' -import { OnInit, Directive } from '@angular/core' +import { Directive, OnInit } from '@angular/core' import { Notifier, RestPagination, RestTable } from '@app/core' -import { Actor } from '@app/shared/shared-main' -import { I18n } from '@ngx-translate/i18n-polyfill' import { AccountBlock } from './account-block.model' import { BlocklistComponentType, BlocklistService } from './blocklist.service' @Directive() +// eslint-disable-next-line @angular-eslint/directive-class-suffix export class GenericAccountBlocklistComponent extends RestTable implements OnInit { - // @ts-ignore: "Abstract methods can only appear within an abstract class" + // @ts-expect-error: "Abstract methods can only appear within an abstract class" abstract mode: BlocklistComponentType blockedAccounts: AccountBlock[] = [] @@ -18,23 +17,18 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni constructor ( private notifier: Notifier, - private blocklistService: BlocklistService, - private i18n: I18n + private blocklistService: BlocklistService ) { super() } - // @ts-ignore: "Abstract methods can only appear within an abstract class" + // @ts-expect-error: "Abstract methods can only appear within an abstract class" abstract getIdentifier (): string ngOnInit () { this.initialize() } - switchToDefaultAvatar ($event: Event) { - ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() - } - unblockAccount (accountBlock: AccountBlock) { const blockedAccount = accountBlock.blockedAccount const operation = this.mode === BlocklistComponentType.Account @@ -45,16 +39,16 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni () => { this.notifier.success( this.mode === BlocklistComponentType.Account - ? this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: blockedAccount.nameWithHost }) - : this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost }) + ? $localize`Account ${blockedAccount.nameWithHost} unmuted.` + : $localize`Account ${blockedAccount.nameWithHost} unmuted by your instance.` ) - this.loadData() + this.reloadData() } ) } - protected loadData () { + protected reloadData () { const operation = this.mode === BlocklistComponentType.Account ? this.blocklistService.getUserAccountBlocklist({ pagination: this.pagination, @@ -67,13 +61,13 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni search: this.search }) - return operation.subscribe( - resultList => { + return operation.subscribe({ + next: resultList => { this.blockedAccounts = resultList.data this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } }