aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-19 14:11:40 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commite0a929179a9dc76e035ca7fda2b61d5ff46afbc5 (patch)
tree1e6615c612ad6995dcb1c3619342dbbc7db35034 /client/src/app
parentaeb1bed9835b3b092832160245080d4023c14d91 (diff)
downloadPeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.tar.gz
PeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.tar.zst
PeerTube-e0a929179a9dc76e035ca7fda2b61d5ff46afbc5.zip
Add filter inputs for blacklisted videos and muted accounts/servers
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html12
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts11
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html10
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts11
-rw-r--r--client/src/app/+admin/moderation/moderation.component.scss8
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss8
-rw-r--r--client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html26
-rw-r--r--client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts12
-rw-r--r--client/src/app/shared/blocklist/blocklist.service.ts12
-rw-r--r--client/src/app/shared/video-blacklist/video-blacklist.service.ts14
10 files changed, 93 insertions, 31 deletions
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 @@
1<p-table 1<p-table
2 [value]="blockedAccounts" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" 2 [value]="blockedAccounts" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" 3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted accounts" 5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted accounts"
6> 6>
7 <ng-template pTemplate="caption">
8 <div class="caption">
9 <div class="ml-auto">
10 <input
11 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
12 (keyup)="onSearch($event)"
13 >
14 </div>
15 </div>
16 </ng-template>
7 17
8 <ng-template pTemplate="header"> 18 <ng-template pTemplate="header">
9 <tr> 19 <tr>
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'
7 7
8@Component({ 8@Component({
9 selector: 'my-instance-account-blocklist', 9 selector: 'my-instance-account-blocklist',
10 styleUrls: [ './instance-account-blocklist.component.scss' ], 10 styleUrls: [ '../moderation.component.scss', './instance-account-blocklist.component.scss' ],
11 templateUrl: './instance-account-blocklist.component.html' 11 templateUrl: './instance-account-blocklist.component.html'
12}) 12})
13export class InstanceAccountBlocklistComponent extends RestTable implements OnInit { 13export class InstanceAccountBlocklistComponent extends RestTable implements OnInit {
14 blockedAccounts: AccountBlock[] = [] 14 blockedAccounts: AccountBlock[] = []
15 totalRecords = 0 15 totalRecords = 0
16 rowsPerPage = 10 16 rowsPerPageOptions = [ 20, 50, 100 ]
17 rowsPerPage = this.rowsPerPageOptions[0]
17 sort: SortMeta = { field: 'createdAt', order: -1 } 18 sort: SortMeta = { field: 'createdAt', order: -1 }
18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
19 20
@@ -49,7 +50,11 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn
49 } 50 }
50 51
51 protected loadData () { 52 protected loadData () {
52 return this.blocklistService.getInstanceAccountBlocklist(this.pagination, this.sort) 53 return this.blocklistService.getInstanceAccountBlocklist({
54 pagination: this.pagination,
55 sort: this.sort,
56 search: this.search
57 })
53 .subscribe( 58 .subscribe(
54 resultList => { 59 resultList => {
55 this.blockedAccounts = resultList.data 60 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 @@
1<p-table 1<p-table
2 [value]="blockedServers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" 2 [value]="blockedServers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" 3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)"
4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted instances" 5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} muted instances"
6> 6>
7 <ng-template pTemplate="caption"> 7 <ng-template pTemplate="caption">
8 <div class="caption"> 8 <div class="caption">
9 <a class="ml-auto block-button" (click)="addServersToBlock()" (key.enter)="addServersToBlock()"> 9 <div class="ml-auto">
10 <input
11 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
12 (keyup)="onSearch($event)"
13 >
14 </div>
15 <a class="ml-2 block-button" (click)="addServersToBlock()" (key.enter)="addServersToBlock()">
10 <my-global-icon iconName="add"></my-global-icon> 16 <my-global-icon iconName="add"></my-global-icon>
11 <ng-container i18n>Mute domain</ng-container> 17 <ng-container i18n>Mute domain</ng-container>
12 </a> 18 </a>
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
9 9
10@Component({ 10@Component({
11 selector: 'my-instance-server-blocklist', 11 selector: 'my-instance-server-blocklist',
12 styleUrls: [ './instance-server-blocklist.component.scss' ], 12 styleUrls: [ '../moderation.component.scss', './instance-server-blocklist.component.scss' ],
13 templateUrl: './instance-server-blocklist.component.html' 13 templateUrl: './instance-server-blocklist.component.html'
14}) 14})
15export class InstanceServerBlocklistComponent extends RestTable implements OnInit { 15export class InstanceServerBlocklistComponent extends RestTable implements OnInit {
@@ -17,7 +17,8 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni
17 17
18 blockedServers: ServerBlock[] = [] 18 blockedServers: ServerBlock[] = []
19 totalRecords = 0 19 totalRecords = 0
20 rowsPerPage = 10 20 rowsPerPageOptions = [ 20, 50, 100 ]
21 rowsPerPage = this.rowsPerPageOptions[0]
21 sort: SortMeta = { field: 'createdAt', order: -1 } 22 sort: SortMeta = { field: 'createdAt', order: -1 }
22 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
23 24
@@ -72,7 +73,11 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni
72 } 73 }
73 74
74 protected loadData () { 75 protected loadData () {
75 return this.blocklistService.getInstanceServerBlocklist(this.pagination, this.sort) 76 return this.blocklistService.getInstanceServerBlocklist({
77 pagination: this.pagination,
78 sort: this.sort,
79 search: this.search
80 })
76 .subscribe( 81 .subscribe(
77 resultList => { 82 resultList => {
78 this.blockedServers = resultList.data 83 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 @@
7 margin-right: 30px; 7 margin-right: 30px;
8} 8}
9 9
10.caption {
11 justify-content: flex-end;
12
13 input {
14 @include peertube-input-text(250px);
15 }
16}
17
10.moderation-expanded { 18.moderation-expanded {
11 font-size: 90%; 19 font-size: 90%;
12 20
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 @@
1@import 'mixins'; 1@import 'mixins';
2@import 'miniature'; 2@import 'miniature';
3 3
4.caption {
5 justify-content: flex-end;
6
7 input {
8 @include peertube-input-text(250px);
9 }
10}
11
12.video-details-date-updated { 4.video-details-date-updated {
13 font-size: 90%; 5 font-size: 90%;
14 margin-top: .1rem; 6 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 @@
1<p-table 1<p-table
2 [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" 2 [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" 3 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} blacklisted videos" 5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} blacklisted videos"
6> 6>
7 <ng-template pTemplate="caption">
8 <div class="caption">
9 <div class="ml-auto">
10 <input
11 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
12 (keyup)="onSearch($event)"
13 >
14 </div>
15 </div>
16 </ng-template>
17
7 <ng-template pTemplate="header"> 18 <ng-template pTemplate="header">
8 <tr> 19 <tr>
9 <th style="width: 40px"></th> 20 <th style="width: 40px"></th>
@@ -33,7 +44,7 @@
33 <div class="video-table-video-text"> 44 <div class="video-table-video-text">
34 <div> 45 <div>
35 {{ videoBlacklist.video.name }} 46 {{ videoBlacklist.video.name }}
36 <span class="glyphicon glyphicon-new-window"></span> 47 <span i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span>
37 </div> 48 </div>
38 <div class="text-muted">by {{ videoBlacklist.video.channel?.displayName }} on {{ videoBlacklist.video.channel?.host }} </div> 49 <div class="text-muted">by {{ videoBlacklist.video.channel?.displayName }} on {{ videoBlacklist.video.channel?.host }} </div>
39 </div> 50 </div>
@@ -53,7 +64,10 @@
53 </ng-container> 64 </ng-container>
54 65
55 <td class="action-cell"> 66 <td class="action-cell">
56 <my-action-dropdown i18n-label placement="bottom-right" label="Actions" [actions]="videoBlacklistActions" [entry]="videoBlacklist"></my-action-dropdown> 67 <my-action-dropdown
68 [ngClass]="{ 'show': expanded }" placement="bottom-right" container="body"
69 i18n-label label="Actions" [actions]="videoBlacklistActions" [entry]="videoBlacklist"
70 ></my-action-dropdown>
57 </td> 71 </td>
58 </tr> 72 </tr>
59 </ng-template> 73 </ng-template>
@@ -61,8 +75,10 @@
61 <ng-template pTemplate="rowexpansion" let-videoBlacklist> 75 <ng-template pTemplate="rowexpansion" let-videoBlacklist>
62 <tr> 76 <tr>
63 <td class="expand-cell" colspan="6"> 77 <td class="expand-cell" colspan="6">
64 <span class="col-2 moderation-expanded-label" i18n>Blacklist reason:</span> 78 <div class="d-flex moderation-expanded">
65 <span class="col-9 moderation-expanded-text" [innerHTML]="videoBlacklist.reasonHtml"></span> 79 <span class="col-2 moderation-expanded-label" i18n>Blacklist reason:</span>
80 <span class="col-9 moderation-expanded-text" [innerHTML]="videoBlacklist.reasonHtml"></span>
81 </div>
66 </td> 82 </td>
67 </tr> 83 </tr>
68 </ng-template> 84 </ng-template>
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'
17export class VideoBlacklistListComponent extends RestTable implements OnInit { 17export class VideoBlacklistListComponent extends RestTable implements OnInit {
18 blacklist: (VideoBlacklist & { reasonHtml?: string })[] = [] 18 blacklist: (VideoBlacklist & { reasonHtml?: string })[] = []
19 totalRecords = 0 19 totalRecords = 0
20 rowsPerPage = 10 20 rowsPerPageOptions = [ 20, 50, 100 ]
21 rowsPerPage = this.rowsPerPageOptions[0]
21 sort: SortMeta = { field: 'createdAt', order: -1 } 22 sort: SortMeta = { field: 'createdAt', order: -1 }
22 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
23 listBlacklistTypeFilter: VideoBlacklistType = undefined 24 listBlacklistTypeFilter: VideoBlacklistType = undefined
@@ -38,7 +39,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
38 ngOnInit () { 39 ngOnInit () {
39 this.serverService.getConfig() 40 this.serverService.getConfig()
40 .subscribe(config => { 41 .subscribe(config => {
41 // don't filter if auto-blacklist not enabled as this will be the only list 42 // don't filter if auto-blacklist is not enabled as this will be the only list
42 if (config.autoBlacklist.videos.ofUsers.enabled) { 43 if (config.autoBlacklist.videos.ofUsers.enabled) {
43 this.listBlacklistTypeFilter = VideoBlacklistType.MANUAL 44 this.listBlacklistTypeFilter = VideoBlacklistType.MANUAL
44 } 45 }
@@ -91,7 +92,12 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
91 } 92 }
92 93
93 protected loadData () { 94 protected loadData () {
94 this.videoBlacklistService.listBlacklist(this.pagination, this.sort, this.listBlacklistTypeFilter) 95 this.videoBlacklistService.listBlacklist({
96 pagination: this.pagination,
97 sort: this.sort,
98 search: this.search,
99 type: this.listBlacklistTypeFilter
100 })
95 .subscribe( 101 .subscribe(
96 async resultList => { 102 async resultList => {
97 this.totalRecords = resultList.total 103 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 {
76 76
77 /*********************** Instance -> Account blocklist ***********************/ 77 /*********************** Instance -> Account blocklist ***********************/
78 78
79 getInstanceAccountBlocklist (pagination: RestPagination, sort: SortMeta) { 79 getInstanceAccountBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) {
80 const { pagination, sort, search } = options
81
80 let params = new HttpParams() 82 let params = new HttpParams()
81 params = this.restService.addRestGetParams(params, pagination, sort) 83 params = this.restService.addRestGetParams(params, pagination, sort)
82 84
85 if (search) params = params.append('search', search)
86
83 return this.authHttp.get<ResultList<AccountBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params }) 87 return this.authHttp.get<ResultList<AccountBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params })
84 .pipe( 88 .pipe(
85 map(res => this.restExtractor.convertResultListDateToHuman(res)), 89 map(res => this.restExtractor.convertResultListDateToHuman(res)),
@@ -104,10 +108,14 @@ export class BlocklistService {
104 108
105 /*********************** Instance -> Server blocklist ***********************/ 109 /*********************** Instance -> Server blocklist ***********************/
106 110
107 getInstanceServerBlocklist (pagination: RestPagination, sort: SortMeta) { 111 getInstanceServerBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) {
112 const { pagination, sort, search } = options
113
108 let params = new HttpParams() 114 let params = new HttpParams()
109 params = this.restService.addRestGetParams(params, pagination, sort) 115 params = this.restService.addRestGetParams(params, pagination, sort)
110 116
117 if (search) params = params.append('search', search)
118
111 return this.authHttp.get<ResultList<ServerBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params }) 119 return this.authHttp.get<ResultList<ServerBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params })
112 .pipe( 120 .pipe(
113 map(res => this.restExtractor.convertResultListDateToHuman(res)), 121 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 {
19 private restExtractor: RestExtractor 19 private restExtractor: RestExtractor
20 ) {} 20 ) {}
21 21
22 listBlacklist (pagination: RestPagination, sort: SortMeta, type?: VideoBlacklistType): Observable<ResultList<VideoBlacklist>> { 22 listBlacklist (options: {
23 pagination: RestPagination,
24 sort: SortMeta,
25 search?: string
26 type?: VideoBlacklistType
27 }): Observable<ResultList<VideoBlacklist>> {
28 const { pagination, sort, search, type } = options
29
23 let params = new HttpParams() 30 let params = new HttpParams()
24 params = this.restService.addRestGetParams(params, pagination, sort) 31 params = this.restService.addRestGetParams(params, pagination, sort)
25 32
26 if (type) { 33 if (search) params = params.append('search', search)
27 params = params.set('type', type.toString()) 34 if (type) params = params.append('type', type.toString())
28 }
29 35
30 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) 36 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params })
31 .pipe( 37 .pipe(