X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fmoderation%2Fvideo-block-list%2Fvideo-block-list.component.ts;h=63143d0f985eb89607b7d99e93c63576294dde9c;hb=2989628b7913383b39ac34c7db8666a21f8e5037;hp=dfd8dc745e3a76351d975fce90748cc1bde518ec;hpb=1fd61899eaea245a5844e33e21f04b2562f16e5e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index dfd8dc745..63143d0f9 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts @@ -2,9 +2,9 @@ import { SortMeta } from 'primeng/api' import { switchMap } from 'rxjs/operators' import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' import { environment } from 'src/environments/environment' -import { AfterViewInit, Component, OnInit } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' -import { ActivatedRoute, Params, Router } from '@angular/router' +import { ActivatedRoute, Router } from '@angular/router' import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' import { AdvancedInputFilter } from '@app/shared/shared-forms' import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' @@ -16,7 +16,7 @@ import { VideoBlacklist, VideoBlacklistType } from '@shared/models' templateUrl: './video-block-list.component.html', styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] }) -export class VideoBlockListComponent extends RestTable implements OnInit, AfterViewInit { +export class VideoBlockListComponent extends RestTable implements OnInit { blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] totalRecords = 0 sort: SortMeta = { field: 'createdAt', order: -1 } @@ -64,7 +64,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV ).subscribe( () => { this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -107,20 +107,14 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV } ngOnInit () { - this.serverService.getConfig() - .subscribe(config => { - // don't filter if auto-blacklist is not enabled as this will be the only list - if (config.autoBlacklist.videos.ofUsers.enabled) { - this.blocklistTypeFilter = VideoBlacklistType.MANUAL - } - }) + const serverConfig = this.serverService.getHTMLConfig() - this.initialize() - this.listenToSearchChange() - } + // Don't filter if auto-blacklist is not enabled as this will be the only list + if (serverConfig.autoBlacklist.videos.ofUsers.enabled) { + this.blocklistTypeFilter = VideoBlacklistType.MANUAL + } - ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search, false) + this.initialize() } getIdentifier () { @@ -144,7 +138,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( () => { this.notifier.success($localize`Video ${entry.video.name} unblocked.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -162,7 +156,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV ) } - protected loadData () { + protected reloadData () { this.videoBlocklistService.listBlocks({ pagination: this.pagination, sort: this.sort,