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'
abuseActions: DropdownAction<ProcessedAbuse>[][] = []
constructor (
+ protected route: ActivatedRoute,
+ protected router: Router,
private notifier: Notifier,
private abuseService: AbuseService,
private blocklistService: BlocklistService,
private videoBlocklistService: VideoBlockService,
private confirmService: ConfirmService,
private markdownRenderer: MarkdownService,
- private sanitizer: DomSanitizer,
- private route: ActivatedRoute,
- private router: Router
+ private sanitizer: DomSanitizer
) {
super()
}
]
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 () {
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
}
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.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