aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.html2
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts39
2 files changed, 6 insertions, 35 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
index 90638d176..1c4149147 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html
@@ -25,7 +25,7 @@
25 </div> 25 </div>
26 <input 26 <input
27 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." 27 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
28 (keyup)="onAbuseSearch($event)" 28 (keyup)="onSearch($event)"
29 > 29 >
30 <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> 30 <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a>
31 <span class="sr-only" i18n>Clear filters</span> 31 <span class="sr-only" i18n>Clear filters</span>
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
5import { environment } from 'src/environments/environment' 5import { environment } from 'src/environments/environment'
6import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core' 6import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core'
7import { DomSanitizer } from '@angular/platform-browser' 7import { DomSanitizer } from '@angular/platform-browser'
8import { ActivatedRoute, Params, Router } from '@angular/router' 8import { ActivatedRoute, Router } from '@angular/router'
9import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core' 9import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
10import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' 10import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main'
11import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' 11import { 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 }