aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.ts2
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.ts2
-rw-r--r--client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts1
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts2
-rw-r--r--client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts2
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html26
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts4
-rw-r--r--client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts2
-rw-r--r--client/src/app/+admin/system/jobs/jobs.component.ts1
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts1
-rw-r--r--client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts1
-rw-r--r--client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts1
-rw-r--r--client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts1
-rw-r--r--client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts2
-rw-r--r--client/src/app/shared/rest/rest-table.ts4
-rw-r--r--server/helpers/middlewares/video-abuses.ts2
-rw-r--r--server/initializers/migrations/0490-abuse-video.ts4
-rw-r--r--server/models/account/account-blocklist.ts4
-rw-r--r--server/models/server/server-blocklist.ts2
-rw-r--r--server/models/utils.ts8
-rw-r--r--server/models/video/video-abuse.ts43
-rw-r--r--server/models/video/video-blacklist.ts2
-rw-r--r--server/models/video/video.ts6
23 files changed, 50 insertions, 73 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
index 00f447bb2..17352a601 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
@@ -14,8 +14,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
14export class FollowersListComponent extends RestTable implements OnInit { 14export class FollowersListComponent extends RestTable implements OnInit {
15 followers: ActorFollow[] = [] 15 followers: ActorFollow[] = []
16 totalRecords = 0 16 totalRecords = 0
17 rowsPerPageOptions = [ 20, 50, 100 ]
18 rowsPerPage = this.rowsPerPageOptions[0]
19 sort: SortMeta = { field: 'createdAt', order: -1 } 17 sort: SortMeta = { field: 'createdAt', order: -1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21 19
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts
index e1b1f8aeb..6ddbf02d6 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.ts
+++ b/client/src/app/+admin/follows/following-list/following-list.component.ts
@@ -18,8 +18,6 @@ export class FollowingListComponent extends RestTable implements OnInit {
18 18
19 following: ActorFollow[] = [] 19 following: ActorFollow[] = []
20 totalRecords = 0 20 totalRecords = 0
21 rowsPerPageOptions = [ 20, 50, 100 ]
22 rowsPerPage = this.rowsPerPageOptions[0]
23 sort: SortMeta = { field: 'createdAt', order: -1 } 21 sort: SortMeta = { field: 'createdAt', order: -1 }
24 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 22 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
25 23
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
index f91800175..267a1f58e 100644
--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
@@ -20,7 +20,6 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
20 20
21 videoRedundancies: VideoRedundancy[] = [] 21 videoRedundancies: VideoRedundancy[] = []
22 totalRecords = 0 22 totalRecords = 0
23 rowsPerPage = 10
24 23
25 sort: SortMeta = { field: 'name', order: 1 } 24 sort: SortMeta = { field: 'name', order: 1 }
26 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 25 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
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 6bd015234..73a9ae75d 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
@@ -14,8 +14,6 @@ import { Actor } from '@app/shared/actor/actor.model'
14export class InstanceAccountBlocklistComponent extends RestTable implements OnInit { 14export class InstanceAccountBlocklistComponent extends RestTable implements OnInit {
15 blockedAccounts: AccountBlock[] = [] 15 blockedAccounts: AccountBlock[] = []
16 totalRecords = 0 16 totalRecords = 0
17 rowsPerPageOptions = [ 20, 50, 100 ]
18 rowsPerPage = this.rowsPerPageOptions[0]
19 sort: SortMeta = { field: 'createdAt', order: -1 } 17 sort: SortMeta = { field: 'createdAt', order: -1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21 19
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 344e2d135..559c9c0b0 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
@@ -17,8 +17,6 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni
17 17
18 blockedServers: ServerBlock[] = [] 18 blockedServers: ServerBlock[] = []
19 totalRecords = 0 19 totalRecords = 0
20 rowsPerPageOptions = [ 20, 50, 100 ]
21 rowsPerPage = this.rowsPerPageOptions[0]
22 sort: SortMeta = { field: 'createdAt', order: -1 } 20 sort: SortMeta = { field: 'createdAt', order: -1 }
23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 21 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
24 22
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 6dacfe243..4afa2850b 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
@@ -20,7 +20,7 @@
20 <th style="width: 40px;"></th> 20 <th style="width: 40px;"></th>
21 <th style="width: 20%;" pResizableColumn i18n>Reporter</th> 21 <th style="width: 20%;" pResizableColumn i18n>Reporter</th>
22 <th i18n>Video</th> 22 <th i18n>Video</th>
23 <th style="width:190px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 23 <th style="width: 190px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
24 <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th> 24 <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th>
25 <th style="width: 120px;"></th> 25 <th style="width: 120px;"></th>
26 </tr> 26 </tr>
@@ -59,7 +59,9 @@
59 <span 59 <span
60 class="video-table-video-image-label" *ngIf="videoAbuse.count > 1" 60 class="video-table-video-image-label" *ngIf="videoAbuse.count > 1"
61 i18n-title title="This video has been reported multiple times." 61 i18n-title title="This video has been reported multiple times."
62 >{{ videoAbuse.nth }}/{{ videoAbuse.count }}</span> 62 >
63 {{ videoAbuse.nth }}/{{ videoAbuse.count }}
64 </span>
63 </div> 65 </div>
64 <div class="video-table-video-text"> 66 <div class="video-table-video-text">
65 <div> 67 <div>
@@ -67,7 +69,7 @@
67 <span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span> 69 <span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span>
68 <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span> 70 <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span>
69 </div> 71 </div>
70 <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> 72 <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
71 </div> 73 </div>
72 </div> 74 </div>
73 </a> 75 </a>
@@ -75,13 +77,15 @@
75 77
76 <td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse"> 78 <td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse">
77 <div class="video-table-video" i18n-title title="Video was deleted"> 79 <div class="video-table-video" i18n-title title="Video was deleted">
78 <div class="video-table-video-image"><span i18n>Deleted</span></div> 80 <div class="video-table-video-image">
81 <span i18n>Deleted</span>
82 </div>
79 <div class="video-table-video-text"> 83 <div class="video-table-video-text">
80 <div> 84 <div>
81 {{ videoAbuse.video.name }} 85 {{ videoAbuse.video.name }}
82 <span class="glyphicon glyphicon-trash"></span> 86 <span class="glyphicon glyphicon-trash"></span>
83 </div> 87 </div>
84 <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> 88 <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
85 </div> 89 </div>
86 </div> 90 </div>
87 </td> 91 </td>
@@ -107,8 +111,10 @@
107 <tr> 111 <tr>
108 <td class="expand-cell" colspan="6"> 112 <td class="expand-cell" colspan="6">
109 <div class="d-flex moderation-expanded"> 113 <div class="d-flex moderation-expanded">
110 <!-- report metadata --> 114 <!-- report left part (report details) -->
111 <div class="col-8"> 115 <div class="col-8">
116
117 <!-- report metadata -->
112 <div class="d-flex"> 118 <div class="d-flex">
113 <span class="col-3 moderation-expanded-label" i18n>Reporter</span> 119 <span class="col-3 moderation-expanded-label" i18n>Reporter</span>
114 <span class="col-9 moderation-expanded-text"> 120 <span class="col-9 moderation-expanded-text">
@@ -128,6 +134,7 @@
128 </a> 134 </a>
129 </span> 135 </span>
130 </div> 136 </div>
137
131 <div class="d-flex"> 138 <div class="d-flex">
132 <span class="col-3 moderation-expanded-label" i18n>Reportee</span> 139 <span class="col-3 moderation-expanded-label" i18n>Reportee</span>
133 <span class="col-9 moderation-expanded-text"> 140 <span class="col-9 moderation-expanded-text">
@@ -147,6 +154,7 @@
147 </a> 154 </a>
148 </span> 155 </span>
149 </div> 156 </div>
157
150 <div class="d-flex"> 158 <div class="d-flex">
151 <span class="col-3 moderation-expanded-label" i18n>Updated</span> 159 <span class="col-3 moderation-expanded-label" i18n>Updated</span>
152 <time class="col-9 moderation-expanded-text video-details-date-updated">{{ videoAbuse.updatedAt | date: 'medium' }}</time> 160 <time class="col-9 moderation-expanded-text video-details-date-updated">{{ videoAbuse.updatedAt | date: 'medium' }}</time>
@@ -157,16 +165,20 @@
157 <span class="col-3 moderation-expanded-label" i18n>Report #{{ videoAbuse.id }}</span> 165 <span class="col-3 moderation-expanded-label" i18n>Report #{{ videoAbuse.id }}</span>
158 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span> 166 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span>
159 </div> 167 </div>
168
160 <div class="mt-3 d-flex" *ngIf="videoAbuse.moderationComment"> 169 <div class="mt-3 d-flex" *ngIf="videoAbuse.moderationComment">
161 <span class="col-3 moderation-expanded-label" i18n>Note</span> 170 <span class="col-3 moderation-expanded-label" i18n>Note</span>
162 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.moderationCommentHtml"></span> 171 <span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.moderationCommentHtml"></span>
163 </div> 172 </div>
173
164 </div> 174 </div>
165 175
176 <!-- report right part (video details) -->
166 <div class="col-4"> 177 <div class="col-4">
167 <div class="screenratio"> 178 <div class="screenratio">
168 <div *ngIf="videoAbuse.video.deleted || videoAbuse.video.blacklisted"> 179 <div *ngIf="videoAbuse.video.deleted || videoAbuse.video.blacklisted">
169 <span i18n>The video was {{ videoAbuse.video.deleted ? 'deleted' : 'blacklisted' }}</span> 180 <span i18n *ngIf="videoAbuse.video.deleted">The video was deleted</span>
181 <span i18n *ngIf="!videoAbuse.video.deleted">The video was blacklisted</span>
170 </div> 182 </div>
171 <div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div> 183 <div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div>
172 </div> 184 </div>
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 2ece5dcc1..f04efa9fc 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
@@ -29,8 +29,6 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV
29 29
30 videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] 30 videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = []
31 totalRecords = 0 31 totalRecords = 0
32 rowsPerPageOptions = [ 20, 50, 100 ]
33 rowsPerPage = this.rowsPerPageOptions[0]
34 sort: SortMeta = { field: 'createdAt', order: 1 } 32 sort: SortMeta = { field: 'createdAt', order: 1 }
35 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 33 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
36 34
@@ -199,7 +197,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV
199 } 197 }
200 198
201 ngAfterViewInit () { 199 ngAfterViewInit () {
202 this.setTableFilter(this.search) 200 if (this.search) this.setTableFilter(this.search)
203 } 201 }
204 202
205 getIdentifier () { 203 getIdentifier () {
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 e9925f9bf..63ecdeb9f 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,8 +17,6 @@ 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 rowsPerPageOptions = [ 20, 50, 100 ]
21 rowsPerPage = this.rowsPerPageOptions[0]
22 sort: SortMeta = { field: 'createdAt', order: -1 } 20 sort: SortMeta = { field: 'createdAt', order: -1 }
23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 21 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
24 listBlacklistTypeFilter: VideoBlacklistType = undefined 22 listBlacklistTypeFilter: VideoBlacklistType = undefined
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts
index dc8343b52..4f7f7c368 100644
--- a/client/src/app/+admin/system/jobs/jobs.component.ts
+++ b/client/src/app/+admin/system/jobs/jobs.component.ts
@@ -40,7 +40,6 @@ export class JobsComponent extends RestTable implements OnInit {
40 40
41 jobs: Job[] = [] 41 jobs: Job[] = []
42 totalRecords: number 42 totalRecords: number
43 rowsPerPage = 10
44 sort: SortMeta = { field: 'createdAt', order: -1 } 43 sort: SortMeta = { field: 'createdAt', order: -1 }
45 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 44 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
46 45
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index 667a0e1fd..da50b7ed0 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -19,7 +19,6 @@ export class UserListComponent extends RestTable implements OnInit {
19 19
20 users: User[] = [] 20 users: User[] = []
21 totalRecords = 0 21 totalRecords = 0
22 rowsPerPage = 10
23 sort: SortMeta = { field: 'createdAt', order: 1 } 22 sort: SortMeta = { field: 'createdAt', order: 1 }
24 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
25 24
diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts
index d8e9fc514..fd1fabcdb 100644
--- a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts
+++ b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts
@@ -13,7 +13,6 @@ import { AccountBlock, BlocklistService } from '@app/shared/blocklist'
13export class MyAccountBlocklistComponent extends RestTable implements OnInit { 13export class MyAccountBlocklistComponent extends RestTable implements OnInit {
14 blockedAccounts: AccountBlock[] = [] 14 blockedAccounts: AccountBlock[] = []
15 totalRecords = 0 15 totalRecords = 0
16 rowsPerPage = 10
17 sort: SortMeta = { field: 'createdAt', order: -1 } 16 sort: SortMeta = { field: 'createdAt', order: -1 }
18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 17 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
19 18
diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts
index 9049dc69c..483c11804 100644
--- a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts
+++ b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts
@@ -14,7 +14,6 @@ import { BlocklistService } from '@app/shared/blocklist'
14export class MyAccountServerBlocklistComponent extends RestTable implements OnInit { 14export class MyAccountServerBlocklistComponent extends RestTable implements OnInit {
15 blockedServers: ServerBlock[] = [] 15 blockedServers: ServerBlock[] = []
16 totalRecords = 0 16 totalRecords = 0
17 rowsPerPage = 10
18 sort: SortMeta = { field: 'createdAt', order: -1 } 17 sort: SortMeta = { field: 'createdAt', order: -1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20 19
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts
index 324641be1..f0a6303d1 100644
--- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts
+++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts
@@ -14,7 +14,6 @@ import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership
14export class MyAccountOwnershipComponent extends RestTable implements OnInit { 14export class MyAccountOwnershipComponent extends RestTable implements OnInit {
15 videoChangeOwnerships: VideoChangeOwnership[] = [] 15 videoChangeOwnerships: VideoChangeOwnership[] = []
16 totalRecords = 0 16 totalRecords = 0
17 rowsPerPage = 10
18 sort: SortMeta = { field: 'createdAt', order: -1 } 17 sort: SortMeta = { field: 'createdAt', order: -1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 18 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20 19
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
index 9281f9789..4452154eb 100644
--- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
+++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'
2import { RestPagination, RestTable } from '@app/shared' 2import { RestPagination, RestTable } from '@app/shared'
3import { SortMeta } from 'primeng/api' 3import { SortMeta } from 'primeng/api'
4import { Notifier } from '@app/core' 4import { Notifier } from '@app/core'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { VideoImport, VideoImportState } from '../../../../../shared/models/videos' 5import { VideoImport, VideoImportState } from '../../../../../shared/models/videos'
7import { VideoImportService } from '@app/shared/video-import' 6import { VideoImportService } from '@app/shared/video-import'
8 7
@@ -14,7 +13,6 @@ import { VideoImportService } from '@app/shared/video-import'
14export class MyAccountVideoImportsComponent extends RestTable implements OnInit { 13export class MyAccountVideoImportsComponent extends RestTable implements OnInit {
15 videoImports: VideoImport[] = [] 14 videoImports: VideoImport[] = []
16 totalRecords = 0 15 totalRecords = 0
17 rowsPerPage = 10
18 sort: SortMeta = { field: 'createdAt', order: 1 } 16 sort: SortMeta = { field: 'createdAt', order: 1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 17 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20 18
diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts
index 5954a7ba1..891fb7b2b 100644
--- a/client/src/app/shared/rest/rest-table.ts
+++ b/client/src/app/shared/rest/rest-table.ts
@@ -7,11 +7,13 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
7export abstract class RestTable { 7export abstract class RestTable {
8 8
9 abstract totalRecords: number 9 abstract totalRecords: number
10 abstract rowsPerPage: number
11 abstract sort: SortMeta 10 abstract sort: SortMeta
12 abstract pagination: RestPagination 11 abstract pagination: RestPagination
13 12
14 search: string 13 search: string
14 rowsPerPageOptions = [ 10, 20, 50, 100 ]
15 rowsPerPage = this.rowsPerPageOptions[0]
16
15 private searchStream: Subject<string> 17 private searchStream: Subject<string>
16 18
17 abstract getIdentifier (): string 19 abstract getIdentifier (): string
diff --git a/server/helpers/middlewares/video-abuses.ts b/server/helpers/middlewares/video-abuses.ts
index 7553a5eb3..97a5724b6 100644
--- a/server/helpers/middlewares/video-abuses.ts
+++ b/server/helpers/middlewares/video-abuses.ts
@@ -7,7 +7,7 @@ async function doesVideoAbuseExist (abuseIdArg: number | string, videoUUID: stri
7 let videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, null, videoUUID) 7 let videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, null, videoUUID)
8 8
9 if (!videoAbuse) { 9 if (!videoAbuse) {
10 const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined 10 const userId = res.locals.oauth?.token.User.id
11 const video = await fetchVideo(videoUUID, 'all', userId) 11 const video = await fetchVideo(videoUUID, 'all', userId)
12 12
13 if (video) videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, video.id) 13 if (video) videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, video.id)
diff --git a/server/initializers/migrations/0490-abuse-video.ts b/server/initializers/migrations/0490-abuse-video.ts
index 26333feb5..610307aa4 100644
--- a/server/initializers/migrations/0490-abuse-video.ts
+++ b/server/initializers/migrations/0490-abuse-video.ts
@@ -11,10 +11,8 @@ async function up (utils: {
11 allowNull: true 11 allowNull: true
12 } 12 }
13 await utils.queryInterface.addColumn('videoAbuse', 'deletedVideo', deletedVideo) 13 await utils.queryInterface.addColumn('videoAbuse', 'deletedVideo', deletedVideo)
14 await utils.sequelize.query(`ALTER TABLE "videoAbsue" ALTER COLUMN "videoId" DROP NOT NULL;`) 14 await utils.sequelize.query(`ALTER TABLE "videoAbuse" ALTER COLUMN "videoId" DROP NOT NULL;`)
15 await utils.sequelize.query(`ALTER TABLE "videoAbuse" DROP CONSTRAINT IF EXISTS "videoAbuse_videoId_fkey";`) 15 await utils.sequelize.query(`ALTER TABLE "videoAbuse" DROP CONSTRAINT IF EXISTS "videoAbuse_videoId_fkey";`)
16 await utils.sequelize.query(`ALTER TABLE "videoAbuse" ADD CONSTRAINT "videoAbuse_videoId_fkey"
17 FOREIGN KEY ("videoId") REFERENCES video(id) ON UPDATE CASCADE ON DELETE SET NULL;`)
18 16
19} 17}
20 18
diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts
index fe2d5d010..d8a7ce4b4 100644
--- a/server/models/account/account-blocklist.ts
+++ b/server/models/account/account-blocklist.ts
@@ -133,8 +133,8 @@ export class AccountBlocklistModel extends Model<AccountBlocklistModel> {
133 if (search) { 133 if (search) {
134 Object.assign(where, { 134 Object.assign(where, {
135 [Op.or]: [ 135 [Op.or]: [
136 { ...searchAttribute(search, '$BlockedAccount.name$') }, 136 searchAttribute(search, '$BlockedAccount.name$'),
137 { ...searchAttribute(search, '$BlockedAccount.Actor.url$') } 137 searchAttribute(search, '$BlockedAccount.Actor.url$')
138 ] 138 ]
139 }) 139 })
140 } 140 }
diff --git a/server/models/server/server-blocklist.ts b/server/models/server/server-blocklist.ts
index 764203d2c..892024c04 100644
--- a/server/models/server/server-blocklist.ts
+++ b/server/models/server/server-blocklist.ts
@@ -139,8 +139,6 @@ export class ServerBlocklistModel extends Model<ServerBlocklistModel> {
139 } 139 }
140 } 140 }
141 141
142 console.log(search)
143
144 return ServerBlocklistModel 142 return ServerBlocklistModel
145 .scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_SERVER ]) 143 .scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_SERVER ])
146 .findAndCountAll<MServerBlocklistAccountServer>(query) 144 .findAndCountAll<MServerBlocklistAccountServer>(query)
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 7137419a2..bdf2291f0 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -208,13 +208,15 @@ function buildDirectionAndField (value: string) {
208} 208}
209 209
210function searchAttribute (sourceField, targetField) { 210function searchAttribute (sourceField, targetField) {
211 return sourceField 211 if (sourceField) {
212 ? { 212 return {
213 [targetField]: { 213 [targetField]: {
214 [Op.iLike]: `%${sourceField}%` 214 [Op.iLike]: `%${sourceField}%`
215 } 215 }
216 } 216 }
217 : {} 217 } else {
218 return {}
219 }
218} 220}
219 221
220// --------------------------------------------------------------------------- 222// ---------------------------------------------------------------------------
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index e8c3bd823..71b519cd9 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -15,7 +15,7 @@ import { VideoAbuseState, VideoDetails } from '../../../shared'
15import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' 15import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
16import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../typings/models' 16import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../typings/models'
17import * as Bluebird from 'bluebird' 17import * as Bluebird from 'bluebird'
18import { literal, Op } from 'sequelize' 18import { literal, Op, Sequelize } from 'sequelize'
19import { ThumbnailModel } from './thumbnail' 19import { ThumbnailModel } from './thumbnail'
20import { VideoBlacklistModel } from './video-blacklist' 20import { VideoBlacklistModel } from './video-blacklist'
21import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel' 21import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'
@@ -31,7 +31,7 @@ export enum ScopeNames {
31 searchVideo?: string 31 searchVideo?: string
32 searchVideoChannel?: string 32 searchVideoChannel?: string
33 serverAccountId: number 33 serverAccountId: number
34 userAccountId: any 34 userAccountId: number
35 }) => { 35 }) => {
36 let where = { 36 let where = {
37 reporterAccountId: { 37 reporterAccountId: {
@@ -45,28 +45,28 @@ export enum ScopeNames {
45 { 45 {
46 [Op.and]: [ 46 [Op.and]: [
47 { videoId: { [Op.not]: null } }, 47 { videoId: { [Op.not]: null } },
48 { '$Video.name$': { [Op.iLike]: `%${options.search}%` } } 48 searchAttribute(options.search, '$Video.name$')
49 ] 49 ]
50 }, 50 },
51 { 51 {
52 [Op.and]: [ 52 [Op.and]: [
53 { videoId: { [Op.not]: null } }, 53 { videoId: { [Op.not]: null } },
54 { '$Video.VideoChannel.name$': { [Op.iLike]: `%${options.search}%` } } 54 searchAttribute(options.search, '$Video.VideoChannel.name$')
55 ] 55 ]
56 }, 56 },
57 { 57 {
58 [Op.and]: [ 58 [Op.and]: [
59 { deletedVideo: { [Op.not]: null } }, 59 { deletedVideo: { [Op.not]: null } },
60 { deletedVideo: { name: { [Op.iLike]: `%${options.search}%` } } } 60 { deletedVideo: searchAttribute(options.search, 'name') }
61 ] 61 ]
62 }, 62 },
63 { 63 {
64 [Op.and]: [ 64 [Op.and]: [
65 { deletedVideo: { [Op.not]: null } }, 65 { deletedVideo: { [Op.not]: null } },
66 { deletedVideo: { channel: { displayName: { [Op.iLike]: `%${options.search}%` } } } } 66 { deletedVideo: { channel: searchAttribute(options.search, 'displayName') } }
67 ] 67 ]
68 }, 68 },
69 { '$Account.name$': { [Op.iLike]: `%${options.search}%` } } 69 searchAttribute(options.search, '$Account.name$')
70 ] 70 ]
71 }) 71 })
72 } 72 }
@@ -77,13 +77,9 @@ export enum ScopeNames {
77 [ 77 [
78 literal( 78 literal(
79 '(' + 79 '(' +
80 'SELECT t.count ' + 80 'SELECT count(*) ' +
81 'FROM ( ' + 81 'FROM "videoAbuse" ' +
82 'SELECT id, ' + 82 'WHERE "videoId" = "VideoAbuseModel"."videoId" ' +
83 'count(id) OVER (PARTITION BY "videoId") ' +
84 'FROM "videoAbuse" ' +
85 ') t ' +
86 'WHERE t.id = "VideoAbuseModel".id ' +
87 ')' 83 ')'
88 ), 84 ),
89 'countReportsForVideo' 85 'countReportsForVideo'
@@ -118,20 +114,11 @@ export enum ScopeNames {
118 [ 114 [
119 literal( 115 literal(
120 '(' + 116 '(' +
121 'WITH ' + 117 'SELECT count(DISTINCT "videoAbuse"."id") ' +
122 'ids AS ( ' +
123 'SELECT "account"."id" ' +
124 'FROM "account" ' +
125 'INNER JOIN "videoChannel" ON "videoChannel"."accountId" = "account"."id" ' +
126 'INNER JOIN "video" ON "video"."channelId" = "videoChannel"."id" ' +
127 'WHERE "video"."id" = "VideoAbuseModel"."videoId" ' +
128 ') ' +
129 'SELECT count("videoAbuse"."id") ' +
130 'FROM "videoAbuse" ' + 118 'FROM "videoAbuse" ' +
131 'INNER JOIN "video" ON "video"."id" = "videoAbuse"."videoId" ' + 119 'INNER JOIN "video" ON "video"."id" = "videoAbuse"."videoId" ' +
132 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + 120 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +
133 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' + 121 'INNER JOIN "account" ON "videoChannel"."accountId" = "Video->VideoChannel"."accountId" ' +
134 'INNER JOIN ids ON "account"."id" = ids.id ' +
135 ')' 122 ')'
136 ), 123 ),
137 'countReportsForReportee' 124 'countReportsForReportee'
@@ -142,19 +129,19 @@ export enum ScopeNames {
142 { 129 {
143 model: AccountModel, 130 model: AccountModel,
144 required: true, 131 required: true,
145 where: { ...searchAttribute(options.searchReporter, 'name') } 132 where: searchAttribute(options.searchReporter, 'name')
146 }, 133 },
147 { 134 {
148 model: VideoModel, 135 model: VideoModel,
149 required: false, 136 required: false,
150 where: { ...searchAttribute(options.searchVideo, 'name') }, 137 where: searchAttribute(options.searchVideo, 'name'),
151 include: [ 138 include: [
152 { 139 {
153 model: ThumbnailModel 140 model: ThumbnailModel
154 }, 141 },
155 { 142 {
156 model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }), 143 model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),
157 where: { ...searchAttribute(options.searchVideoChannel, 'name') } 144 where: searchAttribute(options.searchVideoChannel, 'name')
158 }, 145 },
159 { 146 {
160 attributes: [ 'id', 'reason', 'unfederated' ], 147 attributes: [ 'id', 'reason', 'unfederated' ],
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 680eba471..8cbfe362e 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -78,7 +78,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> {
78 { 78 {
79 model: VideoModel, 79 model: VideoModel,
80 required: true, 80 required: true,
81 where: { ...searchAttribute(search, 'name') }, 81 where: searchAttribute(search, 'name'),
82 include: [ 82 include: [
83 { 83 {
84 model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }), 84 model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index f32216e90..ccb9d64ca 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -813,10 +813,8 @@ export class VideoModel extends Model<VideoModel> {
813 const details = instance.toFormattedDetailsJSON() 813 const details = instance.toFormattedDetailsJSON()
814 814
815 for (const abuse of instance.VideoAbuses) { 815 for (const abuse of instance.VideoAbuses) {
816 tasks.push((_ => { 816 abuse.deletedVideo = details
817 abuse.deletedVideo = details 817 tasks.push(abuse.save({ transaction: options.transaction }))
818 return abuse.save({ transaction: options.transaction })
819 })())
820 } 818 }
821 819
822 Promise.all(tasks) 820 Promise.all(tasks)