X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-abuse-list%2Fabuse-list-table.component.ts;h=8b5771237e30605109a1dd1ab21dbea76b6edbba;hb=931d3430184143ebd88e5243def6eb1d7acfdbf4;hp=20be94d6e4e81a869cad50ebf257b55dd9c79384;hpb=365d9083c938ea128e04c4f98e6b18dd26d86dd2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 20be94d6e..8b5771237 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts @@ -5,7 +5,7 @@ import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/uti import { environment } from 'src/environments/environment' import { AfterViewInit, Component, Input, OnInit, ViewChild } 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 } from '@app/core' import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' @@ -37,6 +37,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV abuseActions: DropdownAction[][] = [] constructor ( + protected route: ActivatedRoute, + protected router: Router, private notifier: Notifier, private abuseService: AbuseService, private blocklistService: BlocklistService, @@ -45,9 +47,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV private videoBlocklistService: VideoBlockService, private confirmService: ConfirmService, private markdownRenderer: MarkdownService, - private sanitizer: DomSanitizer, - private route: ActivatedRoute, - private router: Router + private sanitizer: DomSanitizer ) { super() } @@ -66,20 +66,11 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV ] this.initialize() - - this.route.queryParams - .subscribe(params => { - this.search = params.search || '' - - logger('On URL change (search: %s).', this.search) - - this.setTableFilter(this.search) - this.loadData() - }) + this.listenToSearchChange() } ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search) + if (this.search) this.setTableFilter(this.search, false) } isAdminView () { @@ -98,26 +89,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV this.loadData() } - /* Table filter functions */ - onAbuseSearch (event: Event) { - this.onSearch(event) - this.setQueryParams((event.target as HTMLInputElement).value) - } - - setQueryParams (search: string) { - const queryParams: Params = {} - if (search) Object.assign(queryParams, { search }) - - this.router.navigate([ this.baseRoute ], { queryParams }) - } - - resetTableFilter () { - this.setTableFilter('') - this.setQueryParams('') - this.resetSearch() - } - /* END Table filter functions */ - isAbuseAccepted (abuse: AdminAbuse) { return abuse.state.id === AbuseState.ACCEPTED } @@ -141,19 +112,16 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV getVideoEmbed (abuse: AdminAbuse) { return buildVideoOrPlaylistEmbed( buildVideoLink({ - baseUrl: `${environment.embedUrl}/videos/embed/${abuse.video.uuid}`, + baseUrl: `${environment.originServerUrl}/videos/embed/${abuse.video.uuid}`, title: false, warningTitle: false, - startTime: abuse.startAt, - stopTime: abuse.endAt - }) + startTime: abuse.video.startAt, + stopTime: abuse.video.endAt + }), + abuse.video.name ) } - switchToDefaultAvatar ($event: Event) { - ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() - } - async removeAbuse (abuse: AdminAbuse) { const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) if (res === false) return