-import { uniq } from 'lodash'
import { FindOptions, Op, Order, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'
import {
AllowNull,
Table,
UpdatedAt
} from 'sequelize-typescript'
+import { exists } from '@server/helpers/custom-validators/misc'
import { getServerActor } from '@server/models/application/application'
import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
+import { uniqify } from '@shared/core-utils'
import { VideoPrivacy } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils'
import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'
count: number
sort: string
+ onLocalVideo?: boolean
isLocal?: boolean
search?: string
searchAccount?: string
searchVideo?: string
}) {
- const { start, count, sort, isLocal, search, searchAccount, searchVideo } = parameters
+ const { start, count, sort, isLocal, search, searchAccount, searchVideo, onLocalVideo } = parameters
const where: WhereOptions = {
deletedAt: null
Object.assign(whereVideo, searchAttribute(searchVideo, 'name'))
}
+ if (exists(onLocalVideo)) {
+ Object.assign(whereVideo, { remote: !onLocalVideo })
+ }
+
const getQuery = (forCount: boolean) => {
return {
offset: start,
)
}
- return uniq(result)
+ return uniqify(result)
}
toFormattedJSON (this: MCommentFormattable) {
if (isVideoOwned) {
const videoOwnerAccount = await AccountModel.loadAccountIdFromVideo(videoId)
- blockerAccountIds.push(videoOwnerAccount.id)
+ if (videoOwnerAccount) blockerAccountIds.push(videoOwnerAccount.id)
}
return blockerAccountIds