From b84d4c809f0b1c4b3f2029f56b81dbca37364f36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Jun 2020 10:42:36 +0200 Subject: [PATCH] Fix video comments feed SQL query --- server/models/video/video-comment.ts | 5 +++++ server/models/video/video.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index ba09522cc..cf2a80d53 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -144,6 +144,11 @@ enum ScopeNames { }, { fields: [ 'accountId' ] + }, + { + fields: [ + { name: 'createdAt', order: 'DESC' } + ] } ] }) diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 02a4c851c..344bfc929 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -23,7 +23,7 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { UserRight, VideoPrivacy, VideoState } from '../../../shared' +import { UserRight, VideoPrivacy, VideoState, ResultList } from '../../../shared' import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' import { Video, VideoDetails } from '../../../shared/models/videos' import { VideoFilter } from '../../../shared/models/videos/video-query.type' @@ -1442,7 +1442,7 @@ export class VideoModel extends Model { private static async getAvailableForApi ( options: BuildVideosQueryOptions, countVideos = true - ) { + ): Promise> { function getCount () { if (countVideos !== true) return Promise.resolve(undefined)