aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-19 23:41:05 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commit36004aa7b0de5cb69a452090770221b192a78eb8 (patch)
treee47af3699c686244891659fa2a86b8f3554de197 /client/src/app/+admin
parent042daa7072c0168b876db2badfc838dba7ac2284 (diff)
downloadPeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.tar.gz
PeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.tar.zst
PeerTube-36004aa7b0de5cb69a452090770221b192a78eb8.zip
Support search param in URL for video abuses
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html6
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts23
2 files changed, 21 insertions, 8 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
index c15e98942..9e084cb73 100644
--- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
+++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
@@ -1,5 +1,5 @@
1<p-table 1<p-table
2 [value]="videoAbuses" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" 2 [value]="videoAbuses" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true" 3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports" 5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
@@ -123,7 +123,7 @@
123 <span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span> 123 <span class="text-muted">{{ createByString(videoAbuse.reporterAccount) }}</span>
124 </div> 124 </div>
125 </div> 125 </div>
126 <a routerLink="/admin/moderation/video-abuses/list" class="ml-auto text-muted video-details-links" i18n> 126 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': videoAbuse.reporterAccount.displayName }" class="ml-auto text-muted video-details-links" i18n>
127 {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span> 127 {videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
128 </a> 128 </a>
129 </span> 129 </span>
@@ -142,7 +142,7 @@
142 <span class="text-muted">{{ videoAbuse.video.channel.ownerAccount ? createByString(videoAbuse.video.channel.ownerAccount) : '' }}</span> 142 <span class="text-muted">{{ videoAbuse.video.channel.ownerAccount ? createByString(videoAbuse.video.channel.ownerAccount) : '' }}</span>
143 </div> 143 </div>
144 </div> 144 </div>
145 <a routerLink="/admin/moderation/video-abuses/list" class="ml-auto text-muted video-details-links" *ngIf="!videoAbuse.video.deleted" i18n> 145 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': videoAbuse.video.channel.ownerAccount.displayName }" class="ml-auto text-muted video-details-links" *ngIf="!videoAbuse.video.deleted" i18n>
146 {videoAbuse.countReportsForReportee, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReportee }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span> 146 {videoAbuse.countReportsForReportee, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReportee }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
147 </a> 147 </a>
148 </span> 148 </span>
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 @@
1import { Component, OnInit, ViewChild } from '@angular/core' 1import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'
2import { Account } from '@app/shared/account/account.model' 2import { Account } from '@app/shared/account/account.model'
3import { Notifier } from '@app/core' 3import { Notifier } from '@app/core'
4import { SortMeta } from 'primeng/api' 4import { SortMeta } from 'primeng/api'
@@ -17,14 +17,14 @@ import { DomSanitizer } from '@angular/platform-browser'
17import { BlocklistService } from '@app/shared/blocklist' 17import { BlocklistService } from '@app/shared/blocklist'
18import { VideoService } from '@app/shared/video/video.service' 18import { VideoService } from '@app/shared/video/video.service'
19import { ActivatedRoute } from '@angular/router' 19import { ActivatedRoute } from '@angular/router'
20import { first } from 'rxjs/operators' 20import { 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})
27export class VideoAbuseListComponent extends RestTable implements OnInit { 27export 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 }