- 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 whereAnd: WhereOptions[] = buildBlockedAccountSQLOptimized(
+ '"VideoCommentModel"."accountId"',
+ [ serverActor.Account.id, '"Video->VideoChannel"."accountId"' ]
+ )
+
+ if (accountId) {
+ whereAnd.push({
+ [Op.eq]: accountId
+ })
+ }
+
+ const accountWhere = {
+ [Op.and]: whereAnd
+ }
+
+ const videoChannelWhere = videoChannelId ? { id: videoChannelId } : undefined
+