From b5206dfc455c119b0dcb897bd7144be6ea4d999d Mon Sep 17 00:00:00 2001 From: Julien Maulny Date: Tue, 3 Dec 2019 21:48:31 +0100 Subject: Fix retrieving of deleted comments when subscribing to a new instance --- server/models/video/video-comment.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'server/models') diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index b44d65138..869a42afe 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -507,27 +507,30 @@ export class VideoCommentModel extends Model { } toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject { + let inReplyTo: string + // New thread, so in AS we reply to the video + if (this.inReplyToCommentId === null) { + inReplyTo = this.Video.url + } else { + inReplyTo = this.InReplyToVideoComment.url + } + if (this.isDeleted()) { return { id: this.url, type: 'Tombstone', formerType: 'Note', + inReplyTo, published: this.createdAt.toISOString(), updated: this.updatedAt.toISOString(), deleted: this.deletedAt.toISOString() } } - let inReplyTo: string - // New thread, so in AS we reply to the video - if (this.inReplyToCommentId === null) { - inReplyTo = this.Video.url - } else { - inReplyTo = this.InReplyToVideoComment.url - } - const tag: ActivityTagObject[] = [] for (const parentComment of threadParentComments) { + if (!parentComment.Account) continue + const actor = parentComment.Account.Actor tag.push({ -- cgit v1.2.3