ActivityPub-federated video streaming platform using P2P directly in your web browser
Factorize rest-table and fix/simplify SQL
Rigel Kent0251197e249c
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.tsindex 00f447bb21..17352a6010 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'export class FollowersListComponent extends RestTable implements OnInit {followers: ActorFollow[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex e1b1f8aeba..6ddbf02d6d 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 {following: ActorFollow[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex f91800175a..267a1f58ef 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 OnInitvideoRedundancies: VideoRedundancy[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'name', order: 1 }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.tsindex 6bd0152345..73a9ae75d4 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'export class InstanceAccountBlocklistComponent extends RestTable implements OnInit {blockedAccounts: AccountBlock[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex 344e2d135d..559c9c0b0c 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 OnIniblockedServers: ServerBlock[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.htmlindex 6dacfe243f..4afa2850bf 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 @@<th style="width: 40px;"></th><th style="width: 20%;" pResizableColumn i18n>Reporter</th><th i18n>Video</th>- <th style="width:190px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>+ <th style="width: 190px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th><th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th><th style="width: 120px;"></th></tr>@@ -59,7 +59,9 @@<spanclass="video-table-video-image-label" *ngIf="videoAbuse.count > 1"i18n-title title="This video has been reported multiple times."- >{{ videoAbuse.nth }}/{{ videoAbuse.count }}</span>+ >+ {{ videoAbuse.nth }}/{{ videoAbuse.count }}+ </span></div><div class="video-table-video-text"><div>@@ -67,7 +69,7 @@<span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span><span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span></div>- <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>+ <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div></div></div></a>@@ -75,13 +77,15 @@<td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse"><div class="video-table-video" i18n-title title="Video was deleted">- <div class="video-table-video-image"><span i18n>Deleted</span></div>+ <div class="video-table-video-image">+ <span i18n>Deleted</span>+ </div><div class="video-table-video-text"><div>{{ videoAbuse.video.name }}<span class="glyphicon glyphicon-trash"></span></div>- <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>+ <div class="text-muted" i18n>by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div></div></div></td>@@ -107,8 +111,10 @@<tr><td class="expand-cell" colspan="6"><div class="d-flex moderation-expanded">- <!-- report metadata -->+ <!-- report left part (report details) --><div class="col-8">++ <!-- report metadata --><div class="d-flex"><span class="col-3 moderation-expanded-label" i18n>Reporter</span><span class="col-9 moderation-expanded-text">@@ -128,6 +134,7 @@</a></span></div>+<div class="d-flex"><span class="col-3 moderation-expanded-label" i18n>Reportee</span><span class="col-9 moderation-expanded-text">@@ -147,6 +154,7 @@</a></span></div>+<div class="d-flex"><span class="col-3 moderation-expanded-label" i18n>Updated</span><time class="col-9 moderation-expanded-text video-details-date-updated">{{ videoAbuse.updatedAt | date: 'medium' }}</time>@@ -157,16 +165,20 @@<span class="col-3 moderation-expanded-label" i18n>Report #{{ videoAbuse.id }}</span><span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span></div>+<div class="mt-3 d-flex" *ngIf="videoAbuse.moderationComment"><span class="col-3 moderation-expanded-label" i18n>Note</span><span class="col-9 moderation-expanded-text" [innerHTML]="videoAbuse.moderationCommentHtml"></span></div>+</div>+ <!-- report right part (video details) --><div class="col-4"><div class="screenratio"><div *ngIf="videoAbuse.video.deleted || videoAbuse.video.blacklisted">- <span i18n>The video was {{ videoAbuse.video.deleted ? 'deleted' : 'blacklisted' }}</span>+ <span i18n *ngIf="videoAbuse.video.deleted">The video was deleted</span>+ <span i18n *ngIf="!videoAbuse.video.deleted">The video was blacklisted</span></div><div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div></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.tsindex 2ece5dcc11..f04efa9fcb 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, AfterVvideoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: 1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }@@ -199,7 +197,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV}ngAfterViewInit () {- this.setTableFilter(this.search)+ if (this.search) this.setTableFilter(this.search)}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.tsindex e9925f9bf4..63ecdeb9ff 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'export class VideoBlacklistListComponent extends RestTable implements OnInit {blacklist: (VideoBlacklist & { reasonHtml?: string })[] = []totalRecords = 0- rowsPerPageOptions = [ 20, 50, 100 ]- rowsPerPage = this.rowsPerPageOptions[0]sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }listBlacklistTypeFilter: VideoBlacklistType = undefineddiff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.tsindex dc8343b52f..4f7f7c3681 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 {jobs: Job[] = []totalRecords: number- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex 667a0e1fd7..da50b7ed07 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 {users: User[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: 1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex d8e9fc5148..fd1fabcdbf 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'export class MyAccountBlocklistComponent extends RestTable implements OnInit {blockedAccounts: AccountBlock[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex 9049dc69c0..483c11804c 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'export class MyAccountServerBlocklistComponent extends RestTable implements OnInit {blockedServers: ServerBlock[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex 324641be16..f0a6303d1c 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-ownershipexport class MyAccountOwnershipComponent extends RestTable implements OnInit {videoChangeOwnerships: VideoChangeOwnership[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }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.tsindex 9281f97894..4452154ebf 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'import { RestPagination, RestTable } from '@app/shared'import { SortMeta } from 'primeng/api'import { Notifier } from '@app/core'-import { I18n } from '@ngx-translate/i18n-polyfill'import { VideoImport, VideoImportState } from '../../../../../shared/models/videos'import { VideoImportService } from '@app/shared/video-import'@@ -14,7 +13,6 @@ import { VideoImportService } from '@app/shared/video-import'export class MyAccountVideoImportsComponent extends RestTable implements OnInit {videoImports: VideoImport[] = []totalRecords = 0- rowsPerPage = 10sort: SortMeta = { field: 'createdAt', order: 1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.tsindex 5954a7ba18..891fb7b2b3 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'export abstract class RestTable {abstract totalRecords: number- abstract rowsPerPage: numberabstract sort: SortMetaabstract pagination: RestPaginationsearch: string+ rowsPerPageOptions = [ 10, 20, 50, 100 ]+ rowsPerPage = this.rowsPerPageOptions[0]+private searchStream: Subject<string>abstract getIdentifier (): stringdiff --git a/server/helpers/middlewares/video-abuses.ts b/server/helpers/middlewares/video-abuses.tsindex 7553a5eb33..97a5724b6d 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: strilet videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, null, videoUUID)if (!videoAbuse) {- const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined+ const userId = res.locals.oauth?.token.User.idconst video = await fetchVideo(videoUUID, 'all', userId)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.tsindex 26333feb58..610307aa48 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: {allowNull: true}await utils.queryInterface.addColumn('videoAbuse', 'deletedVideo', deletedVideo)- await utils.sequelize.query(`ALTER TABLE "videoAbsue" ALTER COLUMN "videoId" DROP NOT NULL;`)+ await utils.sequelize.query(`ALTER TABLE "videoAbuse" ALTER COLUMN "videoId" DROP NOT NULL;`)await utils.sequelize.query(`ALTER TABLE "videoAbuse" DROP CONSTRAINT IF EXISTS "videoAbuse_videoId_fkey";`)- await utils.sequelize.query(`ALTER TABLE "videoAbuse" ADD CONSTRAINT "videoAbuse_videoId_fkey"- FOREIGN KEY ("videoId") REFERENCES video(id) ON UPDATE CASCADE ON DELETE SET NULL;`)}diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.tsindex fe2d5d0103..d8a7ce4b4a 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> {if (search) {Object.assign(where, {[Op.or]: [- { ...searchAttribute(search, '$BlockedAccount.name$') },- { ...searchAttribute(search, '$BlockedAccount.Actor.url$') }+ searchAttribute(search, '$BlockedAccount.name$'),+ searchAttribute(search, '$BlockedAccount.Actor.url$')]})}diff --git a/server/models/server/server-blocklist.ts b/server/models/server/server-blocklist.tsindex 764203d2c4..892024c04a 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> {}}- console.log(search)-return ServerBlocklistModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_SERVER ]).findAndCountAll<MServerBlocklistAccountServer>(query)diff --git a/server/models/utils.ts b/server/models/utils.tsindex 7137419a2e..bdf2291f0c 100644--- a/server/models/utils.ts+++ b/server/models/utils.ts@@ -208,13 +208,15 @@ function buildDirectionAndField (value: string) {}function searchAttribute (sourceField, targetField) {- return sourceField- ? {+ if (sourceField) {+ return {[targetField]: {[Op.iLike]: `%${sourceField}%`}}- : {}+ } else {+ return {}+ }}// ---------------------------------------------------------------------------diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.tsindex e8c3bd8234..71b519cd9a 100644--- a/server/models/video/video-abuse.ts+++ b/server/models/video/video-abuse.ts@@ -15,7 +15,7 @@ import { VideoAbuseState, VideoDetails } from '../../../shared'import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../typings/models'import * as Bluebird from 'bluebird'-import { literal, Op } from 'sequelize'+import { literal, Op, Sequelize } from 'sequelize'import { ThumbnailModel } from './thumbnail'import { VideoBlacklistModel } from './video-blacklist'import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'@@ -31,7 +31,7 @@ export enum ScopeNames {searchVideo?: stringsearchVideoChannel?: stringserverAccountId: number- userAccountId: any+ userAccountId: number}) => {let where = {reporterAccountId: {@@ -45,28 +45,28 @@ export enum ScopeNames {{[Op.and]: [{ videoId: { [Op.not]: null } },- { '$Video.name$': { [Op.iLike]: `%${options.search}%` } }+ searchAttribute(options.search, '$Video.name$')]},{[Op.and]: [{ videoId: { [Op.not]: null } },- { '$Video.VideoChannel.name$': { [Op.iLike]: `%${options.search}%` } }+ searchAttribute(options.search, '$Video.VideoChannel.name$')]},{[Op.and]: [{ deletedVideo: { [Op.not]: null } },- { deletedVideo: { name: { [Op.iLike]: `%${options.search}%` } } }+ { deletedVideo: searchAttribute(options.search, 'name') }]},{[Op.and]: [{ deletedVideo: { [Op.not]: null } },- { deletedVideo: { channel: { displayName: { [Op.iLike]: `%${options.search}%` } } } }+ { deletedVideo: { channel: searchAttribute(options.search, 'displayName') } }]},- { '$Account.name$': { [Op.iLike]: `%${options.search}%` } }+ searchAttribute(options.search, '$Account.name$')]})}@@ -77,13 +77,9 @@ export enum ScopeNames {[literal('(' +- 'SELECT t.count ' +- 'FROM ( ' +- 'SELECT id, ' +- 'count(id) OVER (PARTITION BY "videoId") ' +- 'FROM "videoAbuse" ' +- ') t ' +- 'WHERE t.id = "VideoAbuseModel".id ' ++ 'SELECT count(*) ' ++ 'FROM "videoAbuse" ' ++ 'WHERE "videoId" = "VideoAbuseModel"."videoId" ' +')'),'countReportsForVideo'@@ -118,20 +114,11 @@ export enum ScopeNames {[literal('(' +- 'WITH ' +- 'ids AS ( ' +- 'SELECT "account"."id" ' +- 'FROM "account" ' +- 'INNER JOIN "videoChannel" ON "videoChannel"."accountId" = "account"."id" ' +- 'INNER JOIN "video" ON "video"."channelId" = "videoChannel"."id" ' +- 'WHERE "video"."id" = "VideoAbuseModel"."videoId" ' +- ') ' +- 'SELECT count("videoAbuse"."id") ' ++ 'SELECT count(DISTINCT "videoAbuse"."id") ' +'FROM "videoAbuse" ' +'INNER JOIN "video" ON "video"."id" = "videoAbuse"."videoId" ' +'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +- 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' +- 'INNER JOIN ids ON "account"."id" = ids.id ' ++ 'INNER JOIN "account" ON "videoChannel"."accountId" = "Video->VideoChannel"."accountId" ' +')'),'countReportsForReportee'@@ -142,19 +129,19 @@ export enum ScopeNames {{model: AccountModel,required: true,- where: { ...searchAttribute(options.searchReporter, 'name') }+ where: searchAttribute(options.searchReporter, 'name')},{model: VideoModel,required: false,- where: { ...searchAttribute(options.searchVideo, 'name') },+ where: searchAttribute(options.searchVideo, 'name'),include: [{model: ThumbnailModel},{model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),- where: { ...searchAttribute(options.searchVideoChannel, 'name') }+ where: searchAttribute(options.searchVideoChannel, 'name')},{attributes: [ 'id', 'reason', 'unfederated' ],diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.tsindex 680eba471e..8cbfe362e8 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> {{model: VideoModel,required: true,- where: { ...searchAttribute(search, 'name') },+ where: searchAttribute(search, 'name'),include: [{model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),diff --git a/server/models/video/video.ts b/server/models/video/video.tsindex f32216e908..ccb9d64ca4 100644--- a/server/models/video/video.ts+++ b/server/models/video/video.ts@@ -813,10 +813,8 @@ export class VideoModel extends Model<VideoModel> {const details = instance.toFormattedDetailsJSON()for (const abuse of instance.VideoAbuses) {- tasks.push((_ => {- abuse.deletedVideo = details- return abuse.save({ transaction: options.transaction })- })())+ abuse.deletedVideo = details+ tasks.push(abuse.save({ transaction: options.transaction }))}Promise.all(tasks)