- static listForFeed (start: number, count: number, videoId?: number): Bluebird<MCommentOwnerVideoFeed[]> {
+ static async listForFeed (parameters: {
+ start: number
+ count: number
+ videoId?: number
+ accountId?: number
+ videoChannelId?: number
+ }): Promise<MCommentOwnerVideoFeed[]> {
+ const serverActor = await getServerActor()
+ const { start, count, videoId, accountId, videoChannelId } = parameters
+
+ const accountExclusion = {
+ [Op.notIn]: Sequelize.literal(
+ '(' + buildBlockedAccountSQL([ serverActor.Account.id, '"Video->VideoChannel"."accountId"' ]) + ')'
+ )
+ }
+ const accountWhere = accountId
+ ? {
+ [Op.and]: {
+ ...accountExclusion,
+ [Op.eq]: accountId
+ }
+ }
+ : accountExclusion
+
+ const videoChannelWhere = videoChannelId ? { id: videoChannelId } : undefined
+