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=8d67e9beb42b8c08b91f3e8ef506b2fe86dd1dad;hb=de61544582726713c965d3369902f4a464f72e20;hp=adef16975bdad4b40781fc93737a5091eb71875e;hpb=1378c0d343028f3d40d7d795422684ab9e6a1599;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 adef16975..8d67e9beb 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 @@ -1,14 +1,13 @@ import { SortMeta } from 'primeng/api' import { switchMap } from 'rxjs/operators' -import { buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' import { environment } from 'src/environments/environment' import { Component, OnInit } from '@angular/core' -import { DomSanitizer } from '@angular/platform-browser' 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' +import { DropdownAction, VideoService } from '@app/shared/shared-main' import { VideoBlockService } from '@app/shared/shared-moderation' +import { buildVideoOrPlaylistEmbed } from '@root-helpers/video' import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils' import { VideoBlacklist, VideoBlacklistType } from '@shared/models' @@ -18,7 +17,7 @@ import { VideoBlacklist, VideoBlacklistType } from '@shared/models' styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] }) export class VideoBlockListComponent extends RestTable implements OnInit { - blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] + blocklist: (VideoBlacklist & { reasonHtml?: string })[] = [] totalRecords = 0 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -28,12 +27,17 @@ export class VideoBlockListComponent extends RestTable implements OnInit { inputFilters: AdvancedInputFilter[] = [ { - queryParams: { 'search': 'type:auto' }, - label: $localize`Automatic blocks` - }, - { - queryParams: { 'search': 'type:manual' }, - label: $localize`Manual blocks` + title: $localize`Advanced filters`, + children: [ + { + value: 'type:auto', + label: $localize`Automatic blocks` + }, + { + value: 'type:manual', + label: $localize`Manual blocks` + } + ] } ] @@ -45,7 +49,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit { private confirmService: ConfirmService, private videoBlocklistService: VideoBlockService, private markdownRenderer: MarkdownService, - private sanitizer: DomSanitizer, private videoService: VideoService ) { super() @@ -61,7 +64,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit { label: $localize`Switch video block to manual`, handler: videoBlock => { this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe( - switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true)) + switchMap(_ => this.videoBlocklistService.blockVideo([ { videoId: videoBlock.video.id, unfederate: true } ])) ).subscribe({ next: () => { this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) @@ -120,10 +123,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit { return 'VideoBlockListComponent' } - getVideoUrl (videoBlock: VideoBlacklist) { - return Video.buildWatchUrl(videoBlock.video) - } - toHtml (text: string) { return this.markdownRenderer.textMarkdownToHTML(text) } @@ -146,15 +145,15 @@ export class VideoBlockListComponent extends RestTable implements OnInit { } getVideoEmbed (entry: VideoBlacklist) { - return buildVideoOrPlaylistEmbed( - decorateVideoLink({ + return buildVideoOrPlaylistEmbed({ + embedUrl: decorateVideoLink({ url: buildVideoEmbedLink(entry.video, environment.originServerUrl), title: false, warningTitle: false }), - entry.video.name - ) + embedTitle: entry.video.name + }) } protected reloadData () { @@ -171,8 +170,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit { for (const element of this.blocklist) { Object.assign(element, { - reasonHtml: await this.toHtml(element.reason), - embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(element)) + reasonHtml: await this.toHtml(element.reason) }) } },