From e0a929179a9dc76e035ca7fda2b61d5ff46afbc5 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 19 Apr 2020 14:11:40 +0200 Subject: Add filter inputs for blacklisted videos and muted accounts/servers --- .../instance-account-blocklist.component.html | 12 +++++++++- .../instance-account-blocklist.component.ts | 11 ++++++--- .../instance-server-blocklist.component.html | 10 +++++++-- .../instance-server-blocklist.component.ts | 11 ++++++--- .../+admin/moderation/moderation.component.scss | 8 +++++++ .../video-abuse-list.component.scss | 8 ------- .../video-blacklist-list.component.html | 26 +++++++++++++++++----- .../video-blacklist-list.component.ts | 12 +++++++--- .../src/app/shared/blocklist/blocklist.service.ts | 12 ++++++++-- .../video-blacklist/video-blacklist.service.ts | 14 ++++++++---- 10 files changed, 93 insertions(+), 31 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html index 6d77c8290..d340b5e57 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html @@ -1,9 +1,19 @@ + +
+
+ +
+
+
diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts index a3910177f..607b1cbe0 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts @@ -7,13 +7,14 @@ import { AccountBlock, BlocklistService } from '@app/shared/blocklist' @Component({ selector: 'my-instance-account-blocklist', - styleUrls: [ './instance-account-blocklist.component.scss' ], + styleUrls: [ '../moderation.component.scss', './instance-account-blocklist.component.scss' ], templateUrl: './instance-account-blocklist.component.html' }) export class InstanceAccountBlocklistComponent extends RestTable implements OnInit { blockedAccounts: AccountBlock[] = [] totalRecords = 0 - rowsPerPage = 10 + rowsPerPageOptions = [ 20, 50, 100 ] + rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -49,7 +50,11 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn } protected loadData () { - return this.blocklistService.getInstanceAccountBlocklist(this.pagination, this.sort) + return this.blocklistService.getInstanceAccountBlocklist({ + pagination: this.pagination, + sort: this.sort, + search: this.search + }) .subscribe( resultList => { this.blockedAccounts = resultList.data diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html index 19b33a0f5..b6c87fdc8 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html @@ -1,12 +1,18 @@
- +
+ +
+
Mute domain diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 431729ef2..4efadc386 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -9,7 +9,7 @@ import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-doma @Component({ selector: 'my-instance-server-blocklist', - styleUrls: [ './instance-server-blocklist.component.scss' ], + styleUrls: [ '../moderation.component.scss', './instance-server-blocklist.component.scss' ], templateUrl: './instance-server-blocklist.component.html' }) export class InstanceServerBlocklistComponent extends RestTable implements OnInit { @@ -17,7 +17,8 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni blockedServers: ServerBlock[] = [] totalRecords = 0 - rowsPerPage = 10 + rowsPerPageOptions = [ 20, 50, 100 ] + rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -72,7 +73,11 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni } protected loadData () { - return this.blocklistService.getInstanceServerBlocklist(this.pagination, this.sort) + return this.blocklistService.getInstanceServerBlocklist({ + pagination: this.pagination, + sort: this.sort, + search: this.search + }) .subscribe( resultList => { this.blockedServers = resultList.data diff --git a/client/src/app/+admin/moderation/moderation.component.scss b/client/src/app/+admin/moderation/moderation.component.scss index a4ee65423..97af74541 100644 --- a/client/src/app/+admin/moderation/moderation.component.scss +++ b/client/src/app/+admin/moderation/moderation.component.scss @@ -7,6 +7,14 @@ margin-right: 30px; } +.caption { + justify-content: flex-end; + + input { + @include peertube-input-text(250px); + } +} + .moderation-expanded { font-size: 90%; diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss index a9251e2f0..d6bc34935 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss @@ -1,14 +1,6 @@ @import 'mixins'; @import 'miniature'; -.caption { - justify-content: flex-end; - - input { - @include peertube-input-text(250px); - } -} - .video-details-date-updated { font-size: 90%; margin-top: .1rem; diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index 90a786ad0..6375dacd9 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -1,9 +1,20 @@ + +
+
+ +
+
+
+ @@ -33,7 +44,7 @@
{{ videoBlacklist.video.name }} - +
by {{ videoBlacklist.video.channel?.displayName }} on {{ videoBlacklist.video.channel?.host }}
@@ -53,7 +64,10 @@ - +
@@ -61,8 +75,10 @@ - Blacklist reason: - +
+ Blacklist reason: + +
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index c38d30865..e9925f9bf 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -17,7 +17,8 @@ import { MarkdownService } from '@app/shared/renderer' export class VideoBlacklistListComponent extends RestTable implements OnInit { blacklist: (VideoBlacklist & { reasonHtml?: string })[] = [] totalRecords = 0 - rowsPerPage = 10 + rowsPerPageOptions = [ 20, 50, 100 ] + rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } listBlacklistTypeFilter: VideoBlacklistType = undefined @@ -38,7 +39,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { ngOnInit () { this.serverService.getConfig() .subscribe(config => { - // don't filter if auto-blacklist not enabled as this will be the only list + // don't filter if auto-blacklist is not enabled as this will be the only list if (config.autoBlacklist.videos.ofUsers.enabled) { this.listBlacklistTypeFilter = VideoBlacklistType.MANUAL } @@ -91,7 +92,12 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { } protected loadData () { - this.videoBlacklistService.listBlacklist(this.pagination, this.sort, this.listBlacklistTypeFilter) + this.videoBlacklistService.listBlacklist({ + pagination: this.pagination, + sort: this.sort, + search: this.search, + type: this.listBlacklistTypeFilter + }) .subscribe( async resultList => { this.totalRecords = resultList.total diff --git a/client/src/app/shared/blocklist/blocklist.service.ts b/client/src/app/shared/blocklist/blocklist.service.ts index c1f7312f0..5cf265bc1 100644 --- a/client/src/app/shared/blocklist/blocklist.service.ts +++ b/client/src/app/shared/blocklist/blocklist.service.ts @@ -76,10 +76,14 @@ export class BlocklistService { /*********************** Instance -> Account blocklist ***********************/ - getInstanceAccountBlocklist (pagination: RestPagination, sort: SortMeta) { + getInstanceAccountBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) { + const { pagination, sort, search } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), @@ -104,10 +108,14 @@ export class BlocklistService { /*********************** Instance -> Server blocklist ***********************/ - getInstanceServerBlocklist (pagination: RestPagination, sort: SortMeta) { + getInstanceServerBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) { + const { pagination, sort, search } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index 116177c4a..c0e13a651 100644 --- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts @@ -19,13 +19,19 @@ export class VideoBlacklistService { private restExtractor: RestExtractor ) {} - listBlacklist (pagination: RestPagination, sort: SortMeta, type?: VideoBlacklistType): Observable> { + listBlacklist (options: { + pagination: RestPagination, + sort: SortMeta, + search?: string + type?: VideoBlacklistType + }): Observable> { + const { pagination, sort, search, type } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) - if (type) { - params = params.set('type', type.toString()) - } + if (search) params = params.append('search', search) + if (type) params = params.append('type', type.toString()) return this.authHttp.get>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) .pipe( -- cgit v1.2.3