languageOneOf?: string[]
tagsOneOf?: string[]
tagsAllOf?: string[]
+ privacyOneOf?: VideoPrivacy[]
accountId?: number
videoChannelId?: number
search?: string
}) {
VideoModel.throwIfPrivateIncludeWithoutUser(options.include, options.user)
+ VideoModel.throwIfPrivacyOneOfWithoutUser(options.privacyOneOf, options.user)
const trendingDays = options.sort.endsWith('trending')
? CONFIG.TRENDING.VIDEOS.INTERVAL_DAYS
'languageOneOf',
'tagsOneOf',
'tagsAllOf',
+ 'privacyOneOf',
'isLocal',
'include',
'displayOnlyForFollower',
languageOneOf?: string[]
tagsOneOf?: string[]
tagsAllOf?: string[]
+ privacyOneOf?: VideoPrivacy[]
displayOnlyForFollower: DisplayOnlyForFollowerOptions | null
uuids?: string[]
}) {
VideoModel.throwIfPrivateIncludeWithoutUser(options.include, options.user)
+ VideoModel.throwIfPrivacyOneOfWithoutUser(options.privacyOneOf, options.user)
const serverActor = await getServerActor()
'languageOneOf',
'tagsOneOf',
'tagsAllOf',
+ 'privacyOneOf',
'user',
'isLocal',
'host',
private static throwIfPrivateIncludeWithoutUser (include: VideoInclude, user: MUserAccountId) {
if (VideoModel.isPrivateInclude(include) && !user?.hasRight(UserRight.SEE_ALL_VIDEOS)) {
- throw new Error('Try to filter all-local but no user has not the see all videos right')
+ throw new Error('Try to filter all-local but user cannot see all videos')
+ }
+ }
+
+ private static throwIfPrivacyOneOfWithoutUser (privacyOneOf: VideoPrivacy[], user: MUserAccountId) {
+ if (privacyOneOf && !user?.hasRight(UserRight.SEE_ALL_VIDEOS)) {
+ throw new Error('Try to choose video privacies but user cannot see all videos')
}
}
private static isPrivateInclude (include: VideoInclude) {
return include & VideoInclude.BLACKLISTED ||
include & VideoInclude.BLOCKED_OWNER ||
- include & VideoInclude.HIDDEN_PRIVACY ||
include & VideoInclude.NOT_PUBLISHED_STATE
}