2020-05-14 09:56:15 -05:00
|
|
|
import * as Bluebird from 'bluebird'
|
|
|
|
import { uniq } from 'lodash'
|
2020-11-13 09:38:23 -06:00
|
|
|
import { FindAndCountOptions, FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'
|
2020-07-07 03:57:04 -05:00
|
|
|
import {
|
|
|
|
AllowNull,
|
|
|
|
BelongsTo,
|
|
|
|
Column,
|
|
|
|
CreatedAt,
|
|
|
|
DataType,
|
|
|
|
ForeignKey,
|
|
|
|
HasMany,
|
|
|
|
Is,
|
|
|
|
Model,
|
|
|
|
Scopes,
|
|
|
|
Table,
|
|
|
|
UpdatedAt
|
|
|
|
} from 'sequelize-typescript'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { getServerActor } from '@server/models/application/application'
|
2020-06-18 03:45:25 -05:00
|
|
|
import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { VideoPrivacy } from '@shared/models'
|
2019-11-15 12:05:08 -06:00
|
|
|
import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'
|
2017-12-27 03:39:31 -06:00
|
|
|
import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
|
2020-11-13 09:38:23 -06:00
|
|
|
import { VideoComment, VideoCommentAdmin } from '../../../shared/models/videos/video-comment.model'
|
2019-01-04 01:56:20 -06:00
|
|
|
import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
|
2019-01-04 01:56:20 -06:00
|
|
|
import { regexpCapture } from '../../helpers/regexp'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
|
2019-08-15 04:53:26 -05:00
|
|
|
import {
|
|
|
|
MComment,
|
2020-11-13 09:38:23 -06:00
|
|
|
MCommentAdminFormattable,
|
2019-08-21 07:31:57 -05:00
|
|
|
MCommentAP,
|
2019-08-20 12:05:31 -05:00
|
|
|
MCommentFormattable,
|
2019-08-15 04:53:26 -05:00
|
|
|
MCommentId,
|
|
|
|
MCommentOwner,
|
|
|
|
MCommentOwnerReplyVideoLight,
|
|
|
|
MCommentOwnerVideo,
|
|
|
|
MCommentOwnerVideoFeed,
|
2020-05-22 10:06:26 -05:00
|
|
|
MCommentOwnerVideoReply,
|
|
|
|
MVideoImmutable
|
2020-06-18 03:45:25 -05:00
|
|
|
} from '../../types/models/video'
|
2020-07-07 03:57:04 -05:00
|
|
|
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { AccountModel } from '../account/account'
|
2020-05-19 03:48:50 -05:00
|
|
|
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
|
2020-11-13 09:38:23 -06:00
|
|
|
import {
|
|
|
|
buildBlockedAccountSQL,
|
|
|
|
buildBlockedAccountSQLOptimized,
|
|
|
|
buildLocalAccountIdsIn,
|
|
|
|
getCommentSort,
|
|
|
|
searchAttribute,
|
|
|
|
throwIfNotValid
|
|
|
|
} from '../utils'
|
2020-05-14 09:56:15 -05:00
|
|
|
import { VideoModel } from './video'
|
|
|
|
import { VideoChannelModel } from './video-channel'
|
2017-12-22 02:14:50 -06:00
|
|
|
|
2020-07-27 09:26:25 -05:00
|
|
|
export enum ScopeNames {
|
2017-12-27 03:39:31 -06:00
|
|
|
WITH_ACCOUNT = 'WITH_ACCOUNT',
|
2020-05-19 03:48:50 -05:00
|
|
|
WITH_ACCOUNT_FOR_API = 'WITH_ACCOUNT_FOR_API',
|
2017-12-27 09:11:53 -06:00
|
|
|
WITH_IN_REPLY_TO = 'WITH_IN_REPLY_TO',
|
2017-12-28 04:16:08 -06:00
|
|
|
WITH_VIDEO = 'WITH_VIDEO',
|
2017-12-27 09:11:53 -06:00
|
|
|
ATTRIBUTES_FOR_API = 'ATTRIBUTES_FOR_API'
|
2017-12-22 03:50:07 -06:00
|
|
|
}
|
|
|
|
|
2019-04-23 02:50:57 -05:00
|
|
|
@Scopes(() => ({
|
2020-05-22 10:06:26 -05:00
|
|
|
[ScopeNames.ATTRIBUTES_FOR_API]: (blockerAccountIds: number[]) => {
|
2018-10-12 08:26:04 -05:00
|
|
|
return {
|
|
|
|
attributes: {
|
|
|
|
include: [
|
|
|
|
[
|
|
|
|
Sequelize.literal(
|
|
|
|
'(' +
|
2020-05-22 10:06:26 -05:00
|
|
|
'WITH "blocklist" AS (' + buildBlockedAccountSQL(blockerAccountIds) + ')' +
|
2018-10-12 08:26:04 -05:00
|
|
|
'SELECT COUNT("replies"."id") - (' +
|
|
|
|
'SELECT COUNT("replies"."id") ' +
|
|
|
|
'FROM "videoComment" AS "replies" ' +
|
|
|
|
'WHERE "replies"."originCommentId" = "VideoCommentModel"."id" ' +
|
|
|
|
'AND "accountId" IN (SELECT "id" FROM "blocklist")' +
|
|
|
|
')' +
|
|
|
|
'FROM "videoComment" AS "replies" ' +
|
|
|
|
'WHERE "replies"."originCommentId" = "VideoCommentModel"."id" ' +
|
|
|
|
'AND "accountId" NOT IN (SELECT "id" FROM "blocklist")' +
|
|
|
|
')'
|
|
|
|
),
|
|
|
|
'totalReplies'
|
2019-12-28 04:27:31 -06:00
|
|
|
],
|
|
|
|
[
|
|
|
|
Sequelize.literal(
|
|
|
|
'(' +
|
|
|
|
'SELECT COUNT("replies"."id") ' +
|
|
|
|
'FROM "videoComment" AS "replies" ' +
|
2020-01-03 04:53:51 -06:00
|
|
|
'INNER JOIN "video" ON "video"."id" = "replies"."videoId" ' +
|
|
|
|
'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +
|
2019-12-28 04:27:31 -06:00
|
|
|
'WHERE "replies"."originCommentId" = "VideoCommentModel"."id" ' +
|
2020-01-03 04:53:51 -06:00
|
|
|
'AND "replies"."accountId" = "videoChannel"."accountId"' +
|
2019-12-28 04:27:31 -06:00
|
|
|
')'
|
|
|
|
),
|
|
|
|
'totalRepliesFromVideoAuthor'
|
2018-10-12 08:26:04 -05:00
|
|
|
]
|
2017-12-27 09:11:53 -06:00
|
|
|
]
|
2018-10-12 08:26:04 -05:00
|
|
|
}
|
2019-04-23 02:50:57 -05:00
|
|
|
} as FindOptions
|
2017-12-27 09:11:53 -06:00
|
|
|
},
|
2017-12-22 05:10:40 -06:00
|
|
|
[ScopeNames.WITH_ACCOUNT]: {
|
2017-12-22 03:50:07 -06:00
|
|
|
include: [
|
2017-12-27 09:11:53 -06:00
|
|
|
{
|
2019-08-15 04:53:26 -05:00
|
|
|
model: AccountModel
|
2017-12-27 09:11:53 -06:00
|
|
|
}
|
2019-04-23 02:50:57 -05:00
|
|
|
]
|
2017-12-27 03:39:31 -06:00
|
|
|
},
|
2020-05-19 03:48:50 -05:00
|
|
|
[ScopeNames.WITH_ACCOUNT_FOR_API]: {
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: AccountModel.unscoped(),
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
attributes: {
|
|
|
|
exclude: unusedActorAttributesForAPI
|
|
|
|
},
|
|
|
|
model: ActorModel, // Default scope includes avatar and server
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-12-27 03:39:31 -06:00
|
|
|
[ScopeNames.WITH_IN_REPLY_TO]: {
|
|
|
|
include: [
|
|
|
|
{
|
2019-04-23 02:50:57 -05:00
|
|
|
model: VideoCommentModel,
|
2017-12-28 04:16:08 -06:00
|
|
|
as: 'InReplyToVideoComment'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
[ScopeNames.WITH_VIDEO]: {
|
|
|
|
include: [
|
|
|
|
{
|
2019-04-23 02:50:57 -05:00
|
|
|
model: VideoModel,
|
2018-01-04 04:19:16 -06:00
|
|
|
required: true,
|
|
|
|
include: [
|
|
|
|
{
|
2019-08-15 04:53:26 -05:00
|
|
|
model: VideoChannelModel,
|
2018-01-04 04:19:16 -06:00
|
|
|
required: true,
|
|
|
|
include: [
|
|
|
|
{
|
2019-04-23 02:50:57 -05:00
|
|
|
model: AccountModel,
|
2019-08-15 04:53:26 -05:00
|
|
|
required: true
|
2018-01-04 04:19:16 -06:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2017-12-27 03:39:31 -06:00
|
|
|
}
|
2019-04-23 02:50:57 -05:00
|
|
|
]
|
2017-12-22 03:50:07 -06:00
|
|
|
}
|
2019-04-23 02:50:57 -05:00
|
|
|
}))
|
2017-12-22 02:14:50 -06:00
|
|
|
@Table({
|
|
|
|
tableName: 'videoComment',
|
|
|
|
indexes: [
|
|
|
|
{
|
|
|
|
fields: [ 'videoId' ]
|
2017-12-22 03:50:07 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'videoId', 'originCommentId' ]
|
2018-01-26 07:14:43 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'url' ],
|
|
|
|
unique: true
|
2018-07-23 13:13:30 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [ 'accountId' ]
|
2020-06-05 03:42:36 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: [
|
|
|
|
{ name: 'createdAt', order: 'DESC' }
|
|
|
|
]
|
2017-12-22 02:14:50 -06:00
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
export class VideoCommentModel extends Model<VideoCommentModel> {
|
|
|
|
@CreatedAt
|
|
|
|
createdAt: Date
|
|
|
|
|
|
|
|
@UpdatedAt
|
|
|
|
updatedAt: Date
|
|
|
|
|
2019-11-15 12:05:08 -06:00
|
|
|
@AllowNull(true)
|
|
|
|
@Column(DataType.DATE)
|
|
|
|
deletedAt: Date
|
|
|
|
|
2017-12-22 02:14:50 -06:00
|
|
|
@AllowNull(false)
|
|
|
|
@Is('VideoCommentUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
|
|
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
|
|
|
url: string
|
|
|
|
|
|
|
|
@AllowNull(false)
|
|
|
|
@Column(DataType.TEXT)
|
|
|
|
text: string
|
|
|
|
|
|
|
|
@ForeignKey(() => VideoCommentModel)
|
|
|
|
@Column
|
|
|
|
originCommentId: number
|
|
|
|
|
|
|
|
@BelongsTo(() => VideoCommentModel, {
|
|
|
|
foreignKey: {
|
2017-12-28 04:45:10 -06:00
|
|
|
name: 'originCommentId',
|
2017-12-22 02:14:50 -06:00
|
|
|
allowNull: true
|
|
|
|
},
|
2017-12-28 04:45:10 -06:00
|
|
|
as: 'OriginVideoComment',
|
2017-12-22 02:14:50 -06:00
|
|
|
onDelete: 'CASCADE'
|
|
|
|
})
|
|
|
|
OriginVideoComment: VideoCommentModel
|
|
|
|
|
|
|
|
@ForeignKey(() => VideoCommentModel)
|
|
|
|
@Column
|
|
|
|
inReplyToCommentId: number
|
|
|
|
|
|
|
|
@BelongsTo(() => VideoCommentModel, {
|
|
|
|
foreignKey: {
|
2017-12-28 04:45:10 -06:00
|
|
|
name: 'inReplyToCommentId',
|
2017-12-22 02:14:50 -06:00
|
|
|
allowNull: true
|
|
|
|
},
|
2017-12-28 04:16:08 -06:00
|
|
|
as: 'InReplyToVideoComment',
|
2017-12-22 02:14:50 -06:00
|
|
|
onDelete: 'CASCADE'
|
|
|
|
})
|
2018-07-25 15:01:25 -05:00
|
|
|
InReplyToVideoComment: VideoCommentModel | null
|
2017-12-22 02:14:50 -06:00
|
|
|
|
|
|
|
@ForeignKey(() => VideoModel)
|
|
|
|
@Column
|
|
|
|
videoId: number
|
|
|
|
|
|
|
|
@BelongsTo(() => VideoModel, {
|
|
|
|
foreignKey: {
|
|
|
|
allowNull: false
|
|
|
|
},
|
|
|
|
onDelete: 'CASCADE'
|
|
|
|
})
|
|
|
|
Video: VideoModel
|
|
|
|
|
2017-12-22 05:10:40 -06:00
|
|
|
@ForeignKey(() => AccountModel)
|
2017-12-22 02:14:50 -06:00
|
|
|
@Column
|
2017-12-22 05:10:40 -06:00
|
|
|
accountId: number
|
2017-12-22 02:14:50 -06:00
|
|
|
|
2017-12-22 05:10:40 -06:00
|
|
|
@BelongsTo(() => AccountModel, {
|
2017-12-22 02:14:50 -06:00
|
|
|
foreignKey: {
|
2019-11-15 12:05:08 -06:00
|
|
|
allowNull: true
|
2017-12-22 02:14:50 -06:00
|
|
|
},
|
|
|
|
onDelete: 'CASCADE'
|
|
|
|
})
|
2017-12-22 05:10:40 -06:00
|
|
|
Account: AccountModel
|
2017-12-22 02:14:50 -06:00
|
|
|
|
2020-07-07 03:57:04 -05:00
|
|
|
@HasMany(() => VideoCommentAbuseModel, {
|
|
|
|
foreignKey: {
|
2020-07-08 08:51:46 -05:00
|
|
|
name: 'videoCommentId',
|
2020-07-07 03:57:04 -05:00
|
|
|
allowNull: true
|
|
|
|
},
|
|
|
|
onDelete: 'set null'
|
|
|
|
})
|
|
|
|
CommentAbuses: VideoCommentAbuseModel[]
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
static loadById (id: number, t?: Transaction): Bluebird<MComment> {
|
2019-04-18 04:28:17 -05:00
|
|
|
const query: FindOptions = {
|
2017-12-22 03:50:07 -06:00
|
|
|
where: {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t !== undefined) query.transaction = t
|
|
|
|
|
|
|
|
return VideoCommentModel.findOne(query)
|
|
|
|
}
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
static loadByIdAndPopulateVideoAndAccountAndReply (id: number, t?: Transaction): Bluebird<MCommentOwnerVideoReply> {
|
2019-04-18 04:28:17 -05:00
|
|
|
const query: FindOptions = {
|
2017-12-28 04:16:08 -06:00
|
|
|
where: {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t !== undefined) query.transaction = t
|
|
|
|
|
|
|
|
return VideoCommentModel
|
|
|
|
.scope([ ScopeNames.WITH_VIDEO, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_IN_REPLY_TO ])
|
|
|
|
.findOne(query)
|
|
|
|
}
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
static loadByUrlAndPopulateAccountAndVideo (url: string, t?: Transaction): Bluebird<MCommentOwnerVideo> {
|
2019-04-18 04:28:17 -05:00
|
|
|
const query: FindOptions = {
|
2017-12-22 02:14:50 -06:00
|
|
|
where: {
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t !== undefined) query.transaction = t
|
|
|
|
|
2019-08-07 08:35:29 -05:00
|
|
|
return VideoCommentModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEO ]).findOne(query)
|
2017-12-22 02:14:50 -06:00
|
|
|
}
|
2017-12-22 03:50:07 -06:00
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
static loadByUrlAndPopulateReplyAndVideoUrlAndAccount (url: string, t?: Transaction): Bluebird<MCommentOwnerReplyVideoLight> {
|
2019-04-18 04:28:17 -05:00
|
|
|
const query: FindOptions = {
|
2018-01-04 04:19:16 -06:00
|
|
|
where: {
|
|
|
|
url
|
2019-08-06 10:19:53 -05:00
|
|
|
},
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
attributes: [ 'id', 'url' ],
|
|
|
|
model: VideoModel.unscoped()
|
|
|
|
}
|
|
|
|
]
|
2018-01-04 04:19:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t !== undefined) query.transaction = t
|
|
|
|
|
2019-08-06 10:19:53 -05:00
|
|
|
return VideoCommentModel.scope([ ScopeNames.WITH_IN_REPLY_TO, ScopeNames.WITH_ACCOUNT ]).findOne(query)
|
2018-01-04 04:19:16 -06:00
|
|
|
}
|
|
|
|
|
2020-11-13 09:38:23 -06:00
|
|
|
static listCommentsForApi (parameters: {
|
|
|
|
start: number
|
|
|
|
count: number
|
|
|
|
sort: string
|
|
|
|
|
|
|
|
isLocal?: boolean
|
|
|
|
search?: string
|
|
|
|
searchAccount?: string
|
|
|
|
searchVideo?: string
|
|
|
|
}) {
|
|
|
|
const { start, count, sort, isLocal, search, searchAccount, searchVideo } = parameters
|
|
|
|
|
|
|
|
const query: FindAndCountOptions = {
|
|
|
|
offset: start,
|
|
|
|
limit: count,
|
|
|
|
order: getCommentSort(sort)
|
|
|
|
}
|
|
|
|
|
|
|
|
const where: WhereOptions = {
|
|
|
|
isDeleted: false
|
|
|
|
}
|
|
|
|
|
|
|
|
const whereAccount: WhereOptions = {}
|
|
|
|
const whereActor: WhereOptions = {}
|
|
|
|
const whereVideo: WhereOptions = {}
|
|
|
|
|
|
|
|
if (isLocal === true) {
|
|
|
|
Object.assign(where, {
|
|
|
|
serverId: null
|
|
|
|
})
|
|
|
|
} else if (isLocal === false) {
|
|
|
|
Object.assign(where, {
|
|
|
|
serverId: {
|
|
|
|
[Op.ne]: null
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if (search) {
|
|
|
|
Object.assign(where, searchAttribute(search, 'text'))
|
|
|
|
Object.assign(whereActor, searchAttribute(search, 'preferredUsername'))
|
|
|
|
Object.assign(whereAccount, searchAttribute(search, 'name'))
|
|
|
|
Object.assign(whereVideo, searchAttribute(search, 'name'))
|
|
|
|
}
|
|
|
|
|
|
|
|
if (searchAccount) {
|
|
|
|
Object.assign(whereActor, searchAttribute(search, 'preferredUsername'))
|
|
|
|
Object.assign(whereAccount, searchAttribute(search, 'name'))
|
|
|
|
}
|
|
|
|
|
|
|
|
if (searchVideo) {
|
|
|
|
Object.assign(whereVideo, searchAttribute(search, 'name'))
|
|
|
|
}
|
|
|
|
|
|
|
|
query.include = [
|
|
|
|
{
|
|
|
|
model: AccountModel.unscoped(),
|
|
|
|
required: !!searchAccount,
|
|
|
|
where: whereAccount,
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
attributes: {
|
|
|
|
exclude: unusedActorAttributesForAPI
|
|
|
|
},
|
|
|
|
model: ActorModel, // Default scope includes avatar and server
|
|
|
|
required: true,
|
|
|
|
where: whereActor
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: VideoModel.unscoped(),
|
|
|
|
required: true,
|
|
|
|
where: whereVideo
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
return VideoCommentModel
|
|
|
|
.findAndCountAll(query)
|
|
|
|
.then(({ rows, count }) => {
|
|
|
|
return { total: count, data: rows }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-07-18 07:28:37 -05:00
|
|
|
static async listThreadsForApi (parameters: {
|
2020-01-31 09:56:52 -06:00
|
|
|
videoId: number
|
2020-05-22 10:06:26 -05:00
|
|
|
isVideoOwned: boolean
|
2020-01-31 09:56:52 -06:00
|
|
|
start: number
|
|
|
|
count: number
|
|
|
|
sort: string
|
2019-08-15 04:53:26 -05:00
|
|
|
user?: MUserAccountId
|
2019-07-18 07:28:37 -05:00
|
|
|
}) {
|
2020-05-22 10:06:26 -05:00
|
|
|
const { videoId, isVideoOwned, start, count, sort, user } = parameters
|
2019-07-18 07:28:37 -05:00
|
|
|
|
2020-05-22 10:06:26 -05:00
|
|
|
const blockerAccountIds = await VideoCommentModel.buildBlockerAccountIds({ videoId, user, isVideoOwned })
|
2018-10-12 08:26:04 -05:00
|
|
|
|
2017-12-22 03:50:07 -06:00
|
|
|
const query = {
|
|
|
|
offset: start,
|
|
|
|
limit: count,
|
2019-12-27 10:02:34 -06:00
|
|
|
order: getCommentSort(sort),
|
2017-12-22 03:50:07 -06:00
|
|
|
where: {
|
2020-05-19 03:48:50 -05:00
|
|
|
[Op.and]: [
|
|
|
|
{
|
|
|
|
videoId
|
|
|
|
},
|
|
|
|
{
|
|
|
|
inReplyToCommentId: null
|
|
|
|
},
|
|
|
|
{
|
|
|
|
[Op.or]: [
|
|
|
|
{
|
|
|
|
accountId: {
|
|
|
|
[Op.notIn]: Sequelize.literal(
|
2020-05-22 10:06:26 -05:00
|
|
|
'(' + buildBlockedAccountSQL(blockerAccountIds) + ')'
|
2020-05-19 03:48:50 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
accountId: null
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2017-12-22 03:50:07 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-23 02:50:57 -05:00
|
|
|
const scopes: (string | ScopeOptions)[] = [
|
2020-05-19 03:48:50 -05:00
|
|
|
ScopeNames.WITH_ACCOUNT_FOR_API,
|
2018-10-12 08:26:04 -05:00
|
|
|
{
|
2020-05-22 10:06:26 -05:00
|
|
|
method: [ ScopeNames.ATTRIBUTES_FOR_API, blockerAccountIds ]
|
2018-10-12 08:26:04 -05:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2017-12-22 03:50:07 -06:00
|
|
|
return VideoCommentModel
|
2018-10-12 08:26:04 -05:00
|
|
|
.scope(scopes)
|
2017-12-22 03:50:07 -06:00
|
|
|
.findAndCountAll(query)
|
|
|
|
.then(({ rows, count }) => {
|
|
|
|
return { total: count, data: rows }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-07-18 07:28:37 -05:00
|
|
|
static async listThreadCommentsForApi (parameters: {
|
2020-01-31 09:56:52 -06:00
|
|
|
videoId: number
|
2020-05-22 10:06:26 -05:00
|
|
|
isVideoOwned: boolean
|
2020-01-31 09:56:52 -06:00
|
|
|
threadId: number
|
2019-08-15 04:53:26 -05:00
|
|
|
user?: MUserAccountId
|
2019-07-18 07:28:37 -05:00
|
|
|
}) {
|
2020-05-22 10:06:26 -05:00
|
|
|
const { videoId, threadId, user, isVideoOwned } = parameters
|
2019-07-18 07:28:37 -05:00
|
|
|
|
2020-05-22 10:06:26 -05:00
|
|
|
const blockerAccountIds = await VideoCommentModel.buildBlockerAccountIds({ videoId, user, isVideoOwned })
|
2018-10-12 08:26:04 -05:00
|
|
|
|
2017-12-22 03:50:07 -06:00
|
|
|
const query = {
|
2019-04-18 04:28:17 -05:00
|
|
|
order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ] as Order,
|
2017-12-22 03:50:07 -06:00
|
|
|
where: {
|
|
|
|
videoId,
|
2020-01-31 09:56:52 -06:00
|
|
|
[Op.or]: [
|
2017-12-22 03:50:07 -06:00
|
|
|
{ id: threadId },
|
|
|
|
{ originCommentId: threadId }
|
2018-10-12 08:26:04 -05:00
|
|
|
],
|
|
|
|
accountId: {
|
2019-04-18 04:28:17 -05:00
|
|
|
[Op.notIn]: Sequelize.literal(
|
2020-05-22 10:06:26 -05:00
|
|
|
'(' + buildBlockedAccountSQL(blockerAccountIds) + ')'
|
2018-10-12 08:26:04 -05:00
|
|
|
)
|
|
|
|
}
|
2017-12-22 03:50:07 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-12 08:26:04 -05:00
|
|
|
const scopes: any[] = [
|
2020-05-19 03:48:50 -05:00
|
|
|
ScopeNames.WITH_ACCOUNT_FOR_API,
|
2018-10-12 08:26:04 -05:00
|
|
|
{
|
2020-05-22 10:06:26 -05:00
|
|
|
method: [ ScopeNames.ATTRIBUTES_FOR_API, blockerAccountIds ]
|
2018-10-12 08:26:04 -05:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2017-12-22 03:50:07 -06:00
|
|
|
return VideoCommentModel
|
2018-10-12 08:26:04 -05:00
|
|
|
.scope(scopes)
|
2017-12-22 03:50:07 -06:00
|
|
|
.findAndCountAll(query)
|
|
|
|
.then(({ rows, count }) => {
|
|
|
|
return { total: count, data: rows }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
static listThreadParentComments (comment: MCommentId, t: Transaction, order: 'ASC' | 'DESC' = 'ASC'): Bluebird<MCommentOwner[]> {
|
2018-01-05 04:19:25 -06:00
|
|
|
const query = {
|
2019-04-18 04:28:17 -05:00
|
|
|
order: [ [ 'createdAt', order ] ] as Order,
|
2018-01-05 04:19:25 -06:00
|
|
|
where: {
|
|
|
|
id: {
|
2020-01-31 09:56:52 -06:00
|
|
|
[Op.in]: Sequelize.literal('(' +
|
2018-03-21 05:17:01 -05:00
|
|
|
'WITH RECURSIVE children (id, "inReplyToCommentId") AS ( ' +
|
2019-01-04 01:56:20 -06:00
|
|
|
`SELECT id, "inReplyToCommentId" FROM "videoComment" WHERE id = ${comment.id} ` +
|
|
|
|
'UNION ' +
|
|
|
|
'SELECT "parent"."id", "parent"."inReplyToCommentId" FROM "videoComment" "parent" ' +
|
|
|
|
'INNER JOIN "children" ON "children"."inReplyToCommentId" = "parent"."id"' +
|
|
|
|
') ' +
|
2018-03-21 05:17:01 -05:00
|
|
|
'SELECT id FROM children' +
|
|
|
|
')'),
|
2020-01-31 09:56:52 -06:00
|
|
|
[Op.ne]: comment.id
|
2018-01-05 04:19:25 -06:00
|
|
|
}
|
|
|
|
},
|
|
|
|
transaction: t
|
|
|
|
}
|
|
|
|
|
|
|
|
return VideoCommentModel
|
|
|
|
.scope([ ScopeNames.WITH_ACCOUNT ])
|
|
|
|
.findAll(query)
|
|
|
|
}
|
|
|
|
|
2020-05-22 10:06:26 -05:00
|
|
|
static async listAndCountByVideoForAP (video: MVideoImmutable, start: number, count: number, t?: Transaction) {
|
|
|
|
const blockerAccountIds = await VideoCommentModel.buildBlockerAccountIds({
|
|
|
|
videoId: video.id,
|
|
|
|
isVideoOwned: video.isOwned()
|
|
|
|
})
|
|
|
|
|
2018-05-25 09:21:16 -05:00
|
|
|
const query = {
|
2020-05-22 10:06:26 -05:00
|
|
|
order: [ [ 'createdAt', 'ASC' ] ] as Order,
|
2018-06-13 10:43:30 -05:00
|
|
|
offset: start,
|
|
|
|
limit: count,
|
2018-05-25 09:21:16 -05:00
|
|
|
where: {
|
2020-05-22 10:06:26 -05:00
|
|
|
videoId: video.id,
|
|
|
|
accountId: {
|
|
|
|
[Op.notIn]: Sequelize.literal(
|
|
|
|
'(' + buildBlockedAccountSQL(blockerAccountIds) + ')'
|
|
|
|
)
|
|
|
|
}
|
2018-05-25 09:21:16 -05:00
|
|
|
},
|
|
|
|
transaction: t
|
|
|
|
}
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
return VideoCommentModel.findAndCountAll<MComment>(query)
|
2018-05-25 09:21:16 -05:00
|
|
|
}
|
|
|
|
|
2020-06-27 06:12:30 -05:00
|
|
|
static async listForFeed (parameters: {
|
|
|
|
start: number
|
|
|
|
count: number
|
|
|
|
videoId?: number
|
|
|
|
accountId?: number
|
|
|
|
videoChannelId?: number
|
|
|
|
}): Promise<MCommentOwnerVideoFeed[]> {
|
2020-05-06 07:12:12 -05:00
|
|
|
const serverActor = await getServerActor()
|
2020-06-27 06:12:30 -05:00
|
|
|
const { start, count, videoId, accountId, videoChannelId } = parameters
|
|
|
|
|
2020-08-20 01:52:16 -05:00
|
|
|
const whereAnd: WhereOptions[] = buildBlockedAccountSQLOptimized(
|
|
|
|
'"VideoCommentModel"."accountId"',
|
|
|
|
[ serverActor.Account.id, '"Video->VideoChannel"."accountId"' ]
|
|
|
|
)
|
|
|
|
|
|
|
|
if (accountId) {
|
|
|
|
whereAnd.push({
|
|
|
|
[Op.eq]: accountId
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
const accountWhere = {
|
|
|
|
[Op.and]: whereAnd
|
2020-06-27 06:12:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const videoChannelWhere = videoChannelId ? { id: videoChannelId } : undefined
|
2020-05-06 07:12:12 -05:00
|
|
|
|
2018-06-08 13:34:37 -05:00
|
|
|
const query = {
|
2019-04-18 04:28:17 -05:00
|
|
|
order: [ [ 'createdAt', 'DESC' ] ] as Order,
|
2018-06-13 10:43:30 -05:00
|
|
|
offset: start,
|
|
|
|
limit: count,
|
2020-04-21 02:27:42 -05:00
|
|
|
where: {
|
2020-05-06 07:12:12 -05:00
|
|
|
deletedAt: null,
|
2020-06-27 06:12:30 -05:00
|
|
|
accountId: accountWhere
|
2020-04-21 02:27:42 -05:00
|
|
|
},
|
2018-06-08 13:34:37 -05:00
|
|
|
include: [
|
|
|
|
{
|
2018-06-14 04:25:19 -05:00
|
|
|
attributes: [ 'name', 'uuid' ],
|
2018-06-08 13:34:37 -05:00
|
|
|
model: VideoModel.unscoped(),
|
2020-04-21 02:01:39 -05:00
|
|
|
required: true,
|
|
|
|
where: {
|
|
|
|
privacy: VideoPrivacy.PUBLIC
|
2020-05-22 10:06:26 -05:00
|
|
|
},
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
attributes: [ 'accountId' ],
|
|
|
|
model: VideoChannelModel.unscoped(),
|
2020-06-27 06:12:30 -05:00
|
|
|
required: true,
|
|
|
|
where: videoChannelWhere
|
2020-05-22 10:06:26 -05:00
|
|
|
}
|
|
|
|
]
|
2018-06-08 13:34:37 -05:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoId) query.where['videoId'] = videoId
|
|
|
|
|
|
|
|
return VideoCommentModel
|
|
|
|
.scope([ ScopeNames.WITH_ACCOUNT ])
|
|
|
|
.findAll(query)
|
|
|
|
}
|
|
|
|
|
2020-05-14 09:56:15 -05:00
|
|
|
static listForBulkDelete (ofAccount: MAccount, filter: { onVideosOfAccount?: MAccountId } = {}) {
|
|
|
|
const accountWhere = filter.onVideosOfAccount
|
|
|
|
? { id: filter.onVideosOfAccount.id }
|
|
|
|
: {}
|
|
|
|
|
|
|
|
const query = {
|
|
|
|
limit: 1000,
|
|
|
|
where: {
|
|
|
|
deletedAt: null,
|
|
|
|
accountId: ofAccount.id
|
|
|
|
},
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: VideoModel,
|
|
|
|
required: true,
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: VideoChannelModel,
|
|
|
|
required: true,
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: AccountModel,
|
|
|
|
required: true,
|
|
|
|
where: accountWhere
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
return VideoCommentModel
|
|
|
|
.scope([ ScopeNames.WITH_ACCOUNT ])
|
|
|
|
.findAll(query)
|
|
|
|
}
|
|
|
|
|
2018-02-28 11:04:46 -06:00
|
|
|
static async getStats () {
|
|
|
|
const totalLocalVideoComments = await VideoCommentModel.count({
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: AccountModel,
|
|
|
|
required: true,
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
model: ActorModel,
|
|
|
|
required: true,
|
|
|
|
where: {
|
|
|
|
serverId: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
const totalVideoComments = await VideoCommentModel.count()
|
|
|
|
|
|
|
|
return {
|
|
|
|
totalLocalVideoComments,
|
|
|
|
totalVideoComments
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-19 10:23:02 -05:00
|
|
|
static cleanOldCommentsOf (videoId: number, beforeUpdatedAt: Date) {
|
|
|
|
const query = {
|
|
|
|
where: {
|
|
|
|
updatedAt: {
|
2019-04-18 04:28:17 -05:00
|
|
|
[Op.lt]: beforeUpdatedAt
|
2019-03-19 10:23:02 -05:00
|
|
|
},
|
2019-08-06 10:19:53 -05:00
|
|
|
videoId,
|
|
|
|
accountId: {
|
|
|
|
[Op.notIn]: buildLocalAccountIdsIn()
|
2020-05-14 09:56:15 -05:00
|
|
|
},
|
|
|
|
// Do not delete Tombstones
|
|
|
|
deletedAt: null
|
2019-08-06 10:19:53 -05:00
|
|
|
}
|
2019-03-19 10:23:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return VideoCommentModel.destroy(query)
|
|
|
|
}
|
|
|
|
|
2018-12-26 03:36:24 -06:00
|
|
|
getCommentStaticPath () {
|
|
|
|
return this.Video.getWatchStaticPath() + ';threadId=' + this.getThreadId()
|
|
|
|
}
|
|
|
|
|
2018-01-05 04:19:25 -06:00
|
|
|
getThreadId (): number {
|
|
|
|
return this.originCommentId || this.id
|
|
|
|
}
|
|
|
|
|
2018-01-04 04:19:16 -06:00
|
|
|
isOwned () {
|
2019-11-15 12:05:08 -06:00
|
|
|
if (!this.Account) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-01-04 04:19:16 -06:00
|
|
|
return this.Account.isOwned()
|
|
|
|
}
|
|
|
|
|
2019-11-15 12:05:08 -06:00
|
|
|
isDeleted () {
|
2020-01-31 09:56:52 -06:00
|
|
|
return this.deletedAt !== null
|
2019-11-15 12:05:08 -06:00
|
|
|
}
|
|
|
|
|
2019-01-04 01:56:20 -06:00
|
|
|
extractMentions () {
|
2019-02-14 04:04:50 -06:00
|
|
|
let result: string[] = []
|
2019-01-04 01:56:20 -06:00
|
|
|
|
|
|
|
const localMention = `@(${actorNameAlphabet}+)`
|
2019-04-11 04:33:44 -05:00
|
|
|
const remoteMention = `${localMention}@${WEBSERVER.HOST}`
|
2019-01-04 01:56:20 -06:00
|
|
|
|
2019-02-14 04:04:50 -06:00
|
|
|
const mentionRegex = this.isOwned()
|
|
|
|
? '(?:(?:' + remoteMention + ')|(?:' + localMention + '))' // Include local mentions?
|
|
|
|
: '(?:' + remoteMention + ')'
|
|
|
|
|
|
|
|
const firstMentionRegex = new RegExp(`^${mentionRegex} `, 'g')
|
|
|
|
const endMentionRegex = new RegExp(` ${mentionRegex}$`, 'g')
|
2019-01-04 01:56:20 -06:00
|
|
|
const remoteMentionsRegex = new RegExp(' ' + remoteMention + ' ', 'g')
|
|
|
|
|
2019-02-14 04:04:50 -06:00
|
|
|
result = result.concat(
|
|
|
|
regexpCapture(this.text, firstMentionRegex)
|
|
|
|
.map(([ , username1, username2 ]) => username1 || username2),
|
2019-01-04 01:56:20 -06:00
|
|
|
|
2019-02-14 04:04:50 -06:00
|
|
|
regexpCapture(this.text, endMentionRegex)
|
|
|
|
.map(([ , username1, username2 ]) => username1 || username2),
|
|
|
|
|
|
|
|
regexpCapture(this.text, remoteMentionsRegex)
|
|
|
|
.map(([ , username ]) => username)
|
|
|
|
)
|
2019-01-04 01:56:20 -06:00
|
|
|
|
2019-02-14 04:04:50 -06:00
|
|
|
// Include local mentions
|
|
|
|
if (this.isOwned()) {
|
|
|
|
const localMentionsRegex = new RegExp(' ' + localMention + ' ', 'g')
|
2019-01-04 01:56:20 -06:00
|
|
|
|
2019-02-14 04:04:50 -06:00
|
|
|
result = result.concat(
|
|
|
|
regexpCapture(this.text, localMentionsRegex)
|
|
|
|
.map(([ , username ]) => username)
|
2019-01-04 01:56:20 -06:00
|
|
|
)
|
2019-02-14 04:04:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return uniq(result)
|
2019-01-04 01:56:20 -06:00
|
|
|
}
|
|
|
|
|
2019-08-20 12:05:31 -05:00
|
|
|
toFormattedJSON (this: MCommentFormattable) {
|
2017-12-22 03:50:07 -06:00
|
|
|
return {
|
|
|
|
id: this.id,
|
|
|
|
url: this.url,
|
|
|
|
text: this.text,
|
2020-11-13 09:38:23 -06:00
|
|
|
|
2020-07-09 04:58:46 -05:00
|
|
|
threadId: this.getThreadId(),
|
2017-12-27 13:03:37 -06:00
|
|
|
inReplyToCommentId: this.inReplyToCommentId || null,
|
2017-12-22 03:50:07 -06:00
|
|
|
videoId: this.videoId,
|
2020-11-13 09:38:23 -06:00
|
|
|
|
2017-12-22 03:50:07 -06:00
|
|
|
createdAt: this.createdAt,
|
2017-12-22 05:10:40 -06:00
|
|
|
updatedAt: this.updatedAt,
|
2019-11-15 12:05:08 -06:00
|
|
|
deletedAt: this.deletedAt,
|
2020-11-13 09:38:23 -06:00
|
|
|
|
2019-11-15 12:05:08 -06:00
|
|
|
isDeleted: this.isDeleted(),
|
2020-11-13 09:38:23 -06:00
|
|
|
|
2019-12-28 04:27:31 -06:00
|
|
|
totalRepliesFromVideoAuthor: this.get('totalRepliesFromVideoAuthor') || 0,
|
2017-12-27 09:11:53 -06:00
|
|
|
totalReplies: this.get('totalReplies') || 0,
|
2020-11-13 09:38:23 -06:00
|
|
|
|
|
|
|
account: this.Account
|
|
|
|
? this.Account.toFormattedJSON()
|
|
|
|
: null
|
2017-12-22 03:50:07 -06:00
|
|
|
} as VideoComment
|
|
|
|
}
|
2017-12-27 03:39:31 -06:00
|
|
|
|
2020-11-13 09:38:23 -06:00
|
|
|
toFormattedAdminJSON (this: MCommentAdminFormattable) {
|
|
|
|
return {
|
|
|
|
id: this.id,
|
|
|
|
url: this.url,
|
|
|
|
text: this.text,
|
|
|
|
|
|
|
|
threadId: this.getThreadId(),
|
|
|
|
inReplyToCommentId: this.inReplyToCommentId || null,
|
|
|
|
videoId: this.videoId,
|
|
|
|
|
|
|
|
createdAt: this.createdAt,
|
|
|
|
updatedAt: this.updatedAt,
|
|
|
|
|
|
|
|
video: {
|
|
|
|
id: this.Video.id,
|
|
|
|
uuid: this.Video.uuid,
|
|
|
|
name: this.Video.name
|
|
|
|
},
|
|
|
|
|
|
|
|
account: this.Account
|
|
|
|
? this.Account.toFormattedJSON()
|
|
|
|
: null
|
|
|
|
} as VideoCommentAdmin
|
|
|
|
}
|
|
|
|
|
2019-11-15 12:05:08 -06:00
|
|
|
toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject {
|
2019-12-03 14:48:31 -06:00
|
|
|
let inReplyTo: string
|
|
|
|
// New thread, so in AS we reply to the video
|
|
|
|
if (this.inReplyToCommentId === null) {
|
|
|
|
inReplyTo = this.Video.url
|
|
|
|
} else {
|
|
|
|
inReplyTo = this.InReplyToVideoComment.url
|
|
|
|
}
|
|
|
|
|
2019-11-15 12:05:08 -06:00
|
|
|
if (this.isDeleted()) {
|
|
|
|
return {
|
|
|
|
id: this.url,
|
|
|
|
type: 'Tombstone',
|
|
|
|
formerType: 'Note',
|
2019-12-03 14:48:31 -06:00
|
|
|
inReplyTo,
|
2019-11-15 12:05:08 -06:00
|
|
|
published: this.createdAt.toISOString(),
|
|
|
|
updated: this.updatedAt.toISOString(),
|
|
|
|
deleted: this.deletedAt.toISOString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-05 04:19:25 -06:00
|
|
|
const tag: ActivityTagObject[] = []
|
|
|
|
for (const parentComment of threadParentComments) {
|
2019-12-03 14:48:31 -06:00
|
|
|
if (!parentComment.Account) continue
|
|
|
|
|
2018-01-05 04:19:25 -06:00
|
|
|
const actor = parentComment.Account.Actor
|
|
|
|
|
|
|
|
tag.push({
|
|
|
|
type: 'Mention',
|
|
|
|
href: actor.url,
|
|
|
|
name: `@${actor.preferredUsername}@${actor.getHost()}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-12-27 03:39:31 -06:00
|
|
|
return {
|
|
|
|
type: 'Note' as 'Note',
|
|
|
|
id: this.url,
|
|
|
|
content: this.text,
|
|
|
|
inReplyTo,
|
2017-12-28 04:16:08 -06:00
|
|
|
updated: this.updatedAt.toISOString(),
|
2017-12-27 03:39:31 -06:00
|
|
|
published: this.createdAt.toISOString(),
|
2017-12-28 04:16:08 -06:00
|
|
|
url: this.url,
|
2018-01-05 04:19:25 -06:00
|
|
|
attributedTo: this.Account.Actor.url,
|
|
|
|
tag
|
2017-12-27 03:39:31 -06:00
|
|
|
}
|
|
|
|
}
|
2020-05-22 10:06:26 -05:00
|
|
|
|
|
|
|
private static async buildBlockerAccountIds (options: {
|
|
|
|
videoId: number
|
|
|
|
isVideoOwned: boolean
|
|
|
|
user?: MUserAccountId
|
|
|
|
}) {
|
|
|
|
const { videoId, user, isVideoOwned } = options
|
|
|
|
|
|
|
|
const serverActor = await getServerActor()
|
|
|
|
const blockerAccountIds = [ serverActor.Account.id ]
|
|
|
|
|
|
|
|
if (user) blockerAccountIds.push(user.Account.id)
|
|
|
|
|
|
|
|
if (isVideoOwned) {
|
|
|
|
const videoOwnerAccount = await AccountModel.loadAccountIdFromVideo(videoId)
|
|
|
|
blockerAccountIds.push(videoOwnerAccount.id)
|
|
|
|
}
|
|
|
|
|
|
|
|
return blockerAccountIds
|
|
|
|
}
|
2017-12-22 02:14:50 -06:00
|
|
|
}
|