1 import { Component, OnInit } from '@angular/core'
2 import { Notifier } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { RestPagination, RestTable } from '@app/shared'
5 import { SortMeta } from 'primeng/components/common/sortmeta'
6 import { AccountBlock, BlocklistService } from '@app/shared/blocklist'
9 selector: 'my-instance-account-blocklist',
10 styleUrls: [ './instance-account-blocklist.component.scss' ],
11 templateUrl: './instance-account-blocklist.component.html'
13 export class InstanceAccountBlocklistComponent extends RestTable implements OnInit {
14 blockedAccounts: AccountBlock[] = []
17 sort: SortMeta = { field: 'createdAt', order: -1 }
18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21 private notifier: Notifier,
22 private blocklistService: BlocklistService,
32 unblockAccount (accountBlock: AccountBlock) {
33 const blockedAccount = accountBlock.blockedAccount
35 this.blocklistService.unblockAccountByInstance(blockedAccount)
38 this.notifier.success(
39 this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost })
47 protected loadData () {
48 return this.blocklistService.getInstanceAccountBlocklist(this.pagination, this.sort)
51 this.blockedAccounts = resultList.data
52 this.totalRecords = resultList.total
55 err => this.notifier.error(err.message)