X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-moderation%2Faccount-blocklist.component.ts;h=9ed00bc12f211c0cad3d4a7f560f9588c5284629;hb=fba911e2c89708a166636e3a93fcd8fcbc3de7e1;hp=a5a3c27cd0cb279c9d916425425165701831dc00;hpb=a02b93ce756d646a59cef57b5e4ff53c2bb30bec;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 a5a3c27cd..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,15 +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() -// tslint:disable-next-line: directive-class-suffix +// 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[] = [] @@ -19,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 @@ -46,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, @@ -68,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) + }) } }