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 }
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 }
videoRedundancies: VideoRedundancy[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'name', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
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 }
blockedServers: ServerBlock[] = []
totalRecords = 0
- rowsPerPageOptions = [ 20, 50, 100 ]
- rowsPerPage = this.rowsPerPageOptions[0]
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
<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>
<span
class="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>
<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>
<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>
<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">
</a>
</span>
</div>
+
<div class="d-flex">
<span class="col-3 moderation-expanded-label" i18n>Reportee</span>
<span class="col-9 moderation-expanded-text">
</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>
<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>
videoAbuses: (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 }
}
ngAfterViewInit () {
- this.setTableFilter(this.search)
+ if (this.search) this.setTableFilter(this.search)
}
getIdentifier () {
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 = undefined
jobs: Job[] = []
totalRecords: number
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
users: User[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
export class MyAccountBlocklistComponent extends RestTable implements OnInit {
blockedAccounts: AccountBlock[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
export class MyAccountServerBlocklistComponent extends RestTable implements OnInit {
blockedServers: ServerBlock[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
export class MyAccountOwnershipComponent extends RestTable implements OnInit {
videoChangeOwnerships: VideoChangeOwnership[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
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'
export class MyAccountVideoImportsComponent extends RestTable implements OnInit {
videoImports: VideoImport[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'createdAt', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
export abstract class RestTable {
abstract totalRecords: number
- abstract rowsPerPage: number
abstract sort: SortMeta
abstract pagination: RestPagination
search: string
+ rowsPerPageOptions = [ 10, 20, 50, 100 ]
+ rowsPerPage = this.rowsPerPageOptions[0]
+
private searchStream: Subject<string>
abstract getIdentifier (): string
let 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.id
const video = await fetchVideo(videoUUID, 'all', userId)
if (video) videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, video.id)
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;`)
}
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$')
]
})
}
}
}
- console.log(search)
-
return ServerBlocklistModel
.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_SERVER ])
.findAndCountAll<MServerBlocklistAccountServer>(query)
}
function searchAttribute (sourceField, targetField) {
- return sourceField
- ? {
+ if (sourceField) {
+ return {
[targetField]: {
[Op.iLike]: `%${sourceField}%`
}
}
- : {}
+ } else {
+ return {}
+ }
}
// ---------------------------------------------------------------------------
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'
searchVideo?: string
searchVideoChannel?: string
serverAccountId: number
- userAccountId: any
+ userAccountId: number
}) => {
let where = {
reporterAccountId: {
{
[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$')
]
})
}
[
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'
[
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'
{
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' ],
{
model: VideoModel,
required: true,
- where: { ...searchAttribute(search, 'name') },
+ where: searchAttribute(search, 'name'),
include: [
{
model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),
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)