aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorJulien Maulny <julien.maulny@protonmail.com>2019-12-03 21:48:31 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-12-04 09:36:45 +0100
commitb5206dfc455c119b0dcb897bd7144be6ea4d999d (patch)
treed79387081b80c0bbee38beee00f6560a599a99a9 /server/models/video
parent69222afac8f8c41d90295b33f0695bbff352851e (diff)
downloadPeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.tar.gz
PeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.tar.zst
PeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.zip
Fix retrieving of deleted comments when subscribing to a new instance
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-comment.ts19
1 files changed, 11 insertions, 8 deletions
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<VideoCommentModel> {
507 } 507 }
508 508
509 toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject { 509 toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject {
510 let inReplyTo: string
511 // New thread, so in AS we reply to the video
512 if (this.inReplyToCommentId === null) {
513 inReplyTo = this.Video.url
514 } else {
515 inReplyTo = this.InReplyToVideoComment.url
516 }
517
510 if (this.isDeleted()) { 518 if (this.isDeleted()) {
511 return { 519 return {
512 id: this.url, 520 id: this.url,
513 type: 'Tombstone', 521 type: 'Tombstone',
514 formerType: 'Note', 522 formerType: 'Note',
523 inReplyTo,
515 published: this.createdAt.toISOString(), 524 published: this.createdAt.toISOString(),
516 updated: this.updatedAt.toISOString(), 525 updated: this.updatedAt.toISOString(),
517 deleted: this.deletedAt.toISOString() 526 deleted: this.deletedAt.toISOString()
518 } 527 }
519 } 528 }
520 529
521 let inReplyTo: string
522 // New thread, so in AS we reply to the video
523 if (this.inReplyToCommentId === null) {
524 inReplyTo = this.Video.url
525 } else {
526 inReplyTo = this.InReplyToVideoComment.url
527 }
528
529 const tag: ActivityTagObject[] = [] 530 const tag: ActivityTagObject[] = []
530 for (const parentComment of threadParentComments) { 531 for (const parentComment of threadParentComments) {
532 if (!parentComment.Account) continue
533
531 const actor = parentComment.Account.Actor 534 const actor = parentComment.Account.Actor
532 535
533 tag.push({ 536 tag.push({