diff options
Diffstat (limited to 'client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts')
-rw-r--r-- | client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | 39 |
1 files changed, 5 insertions, 34 deletions
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 3bc527684..ca0d23699 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 | |||
5 | import { environment } from 'src/environments/environment' | 5 | import { environment } from 'src/environments/environment' |
6 | import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core' | 6 | import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core' |
7 | import { DomSanitizer } from '@angular/platform-browser' | 7 | import { DomSanitizer } from '@angular/platform-browser' |
8 | import { ActivatedRoute, Params, Router } from '@angular/router' | 8 | import { ActivatedRoute, Router } from '@angular/router' |
9 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' | 9 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' |
10 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 10 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
11 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' | 11 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' |
@@ -37,6 +37,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
37 | abuseActions: DropdownAction<ProcessedAbuse>[][] = [] | 37 | abuseActions: DropdownAction<ProcessedAbuse>[][] = [] |
38 | 38 | ||
39 | constructor ( | 39 | constructor ( |
40 | protected route: ActivatedRoute, | ||
41 | protected router: Router, | ||
40 | private notifier: Notifier, | 42 | private notifier: Notifier, |
41 | private abuseService: AbuseService, | 43 | private abuseService: AbuseService, |
42 | private blocklistService: BlocklistService, | 44 | private blocklistService: BlocklistService, |
@@ -45,9 +47,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
45 | private videoBlocklistService: VideoBlockService, | 47 | private videoBlocklistService: VideoBlockService, |
46 | private confirmService: ConfirmService, | 48 | private confirmService: ConfirmService, |
47 | private markdownRenderer: MarkdownService, | 49 | private markdownRenderer: MarkdownService, |
48 | private sanitizer: DomSanitizer, | 50 | private sanitizer: DomSanitizer |
49 | private route: ActivatedRoute, | ||
50 | private router: Router | ||
51 | ) { | 51 | ) { |
52 | super() | 52 | super() |
53 | } | 53 | } |
@@ -66,16 +66,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
66 | ] | 66 | ] |
67 | 67 | ||
68 | this.initialize() | 68 | this.initialize() |
69 | 69 | this.listenToSearchChange() | |
70 | this.route.queryParams | ||
71 | .subscribe(params => { | ||
72 | this.search = params.search || '' | ||
73 | |||
74 | logger('On URL change (search: %s).', this.search) | ||
75 | |||
76 | this.setTableFilter(this.search) | ||
77 | this.loadData() | ||
78 | }) | ||
79 | } | 70 | } |
80 | 71 | ||
81 | ngAfterViewInit () { | 72 | ngAfterViewInit () { |
@@ -98,26 +89,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
98 | this.loadData() | 89 | this.loadData() |
99 | } | 90 | } |
100 | 91 | ||
101 | /* Table filter functions */ | ||
102 | onAbuseSearch (event: Event) { | ||
103 | this.onSearch(event) | ||
104 | this.setQueryParams((event.target as HTMLInputElement).value) | ||
105 | } | ||
106 | |||
107 | setQueryParams (search: string) { | ||
108 | const queryParams: Params = {} | ||
109 | if (search) Object.assign(queryParams, { search }) | ||
110 | |||
111 | this.router.navigate([ this.baseRoute ], { queryParams }) | ||
112 | } | ||
113 | |||
114 | resetTableFilter () { | ||
115 | this.setTableFilter('') | ||
116 | this.setQueryParams('') | ||
117 | this.resetSearch() | ||
118 | } | ||
119 | /* END Table filter functions */ | ||
120 | |||
121 | isAbuseAccepted (abuse: AdminAbuse) { | 92 | isAbuseAccepted (abuse: AdminAbuse) { |
122 | return abuse.state.id === AbuseState.ACCEPTED | 93 | return abuse.state.id === AbuseState.ACCEPTED |
123 | } | 94 | } |