diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 0c727ae90..2ece5dcc1 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core' |
2 | import { Account } from '@app/shared/account/account.model' | 2 | import { Account } from '@app/shared/account/account.model' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier } from '@app/core' |
4 | import { SortMeta } from 'primeng/api' | 4 | import { SortMeta } from 'primeng/api' |
@@ -17,14 +17,14 @@ import { DomSanitizer } from '@angular/platform-browser' | |||
17 | import { BlocklistService } from '@app/shared/blocklist' | 17 | import { BlocklistService } from '@app/shared/blocklist' |
18 | import { VideoService } from '@app/shared/video/video.service' | 18 | import { VideoService } from '@app/shared/video/video.service' |
19 | import { ActivatedRoute } from '@angular/router' | 19 | import { ActivatedRoute } from '@angular/router' |
20 | import { first } from 'rxjs/operators' | 20 | import { filter } from 'rxjs/operators' |
21 | 21 | ||
22 | @Component({ | 22 | @Component({ |
23 | selector: 'my-video-abuse-list', | 23 | selector: 'my-video-abuse-list', |
24 | templateUrl: './video-abuse-list.component.html', | 24 | templateUrl: './video-abuse-list.component.html', |
25 | styleUrls: [ '../moderation.component.scss', './video-abuse-list.component.scss' ] | 25 | styleUrls: [ '../moderation.component.scss', './video-abuse-list.component.scss' ] |
26 | }) | 26 | }) |
27 | export class VideoAbuseListComponent extends RestTable implements OnInit { | 27 | export class VideoAbuseListComponent extends RestTable implements OnInit, AfterViewInit { |
28 | @ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent | 28 | @ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent |
29 | 29 | ||
30 | videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] | 30 | videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] |
@@ -190,8 +190,16 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
190 | this.initialize() | 190 | this.initialize() |
191 | 191 | ||
192 | this.route.queryParams | 192 | this.route.queryParams |
193 | .pipe(first(params => params.search !== undefined && params.search !== null)) | 193 | .pipe(filter(params => params.search !== undefined && params.search !== null)) |
194 | .subscribe(params => this.search = params.search) | 194 | .subscribe(params => { |
195 | this.search = params.search | ||
196 | this.setTableFilter(params.search) | ||
197 | this.loadData() | ||
198 | }) | ||
199 | } | ||
200 | |||
201 | ngAfterViewInit () { | ||
202 | this.setTableFilter(this.search) | ||
195 | } | 203 | } |
196 | 204 | ||
197 | getIdentifier () { | 205 | getIdentifier () { |
@@ -210,6 +218,11 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
210 | return Account.CREATE_BY_STRING(account.name, account.host) | 218 | return Account.CREATE_BY_STRING(account.name, account.host) |
211 | } | 219 | } |
212 | 220 | ||
221 | setTableFilter (filter: string) { | ||
222 | const filterInput = document.getElementById('table-filter') as HTMLInputElement | ||
223 | if (filterInput) filterInput.value = filter | ||
224 | } | ||
225 | |||
213 | isVideoAbuseAccepted (videoAbuse: VideoAbuse) { | 226 | isVideoAbuseAccepted (videoAbuse: VideoAbuse) { |
214 | return videoAbuse.state.id === VideoAbuseState.ACCEPTED | 227 | return videoAbuse.state.id === VideoAbuseState.ACCEPTED |
215 | } | 228 | } |