]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-comment.ts
Send account activitypub update events
[github/Chocobozzz/PeerTube.git] / server / models / video / video-comment.ts
index 1992c2dd88f1d175d6e88f32f3f0594ad3f86008..63675c20bf688abde380b46fc6820a30c6c782c2 100644 (file)
@@ -103,8 +103,10 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
 
   @BelongsTo(() => VideoCommentModel, {
     foreignKey: {
+      name: 'originCommentId',
       allowNull: true
     },
+    as: 'OriginVideoComment',
     onDelete: 'CASCADE'
   })
   OriginVideoComment: VideoCommentModel
@@ -115,6 +117,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
 
   @BelongsTo(() => VideoCommentModel, {
     foreignKey: {
+      name: 'inReplyToCommentId',
       allowNull: true
     },
     as: 'InReplyToVideoComment',
@@ -211,7 +214,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
 
   static listThreadCommentsForApi (videoId: number, threadId: number) {
     const query = {
-      order: [ [ 'id', 'ASC' ] ],
+      order: [ [ 'createdAt', 'ASC' ] ],
       where: {
         videoId,
         [ Sequelize.Op.or ]: [