Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix add comment in threads with deleted comments

Chocobozzz6cb556449064
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
index 5784efcdf7..0f7c19765c 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
@@ -57,7 +57,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
if (this.parentComment) {
const mentions = this.parentComments
- .filter(c => c.account.id !== this.user.account.id) // Don't add mention of ourselves
+ .filter(c => c.account && c.account.id !== this.user.account.id) // Don't add mention of ourselves
.map(c => '@' + c.by)
const mentionsSet = new Set(mentions)
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
index f7eca45fda..1313b65853 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
@@ -125,7 +125,12 @@ export class VideoCommentComponent implements OnInit, OnChanges {
const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true)
this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html)
this.newParentComments = this.parentComments.concat([ this.comment ])
- this.commentAccount = new Account(this.comment.account)
- this.getUserIfNeeded(this.commentAccount)
+
+ if (this.comment.account) {
+ this.commentAccount = new Account(this.comment.account)
+ this.getUserIfNeeded(this.commentAccount)
+ } else {
+ this.comment.account = null
+ }
}
}
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index f2bb5c4648..f1408effb3 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -183,7 +183,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
// Mark the comment as deleted
this.softDeleteComment(commentToDelete)
- if (this.highlightedThread.id === commentToDelete.id) this.highlightedThread = undefined
+ if (this.highlightedThread?.id === commentToDelete.id) this.highlightedThread = undefined
},
err => this.notifier.error(err.message)
diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts
index 9933ae2b5c..551d04ae35 100644
--- a/server/lib/activitypub/audience.ts
+++ b/server/lib/activitypub/audience.ts
@@ -32,6 +32,8 @@ function getVideoCommentAudience (
// Send to actors we reply to
for (const parentComment of threadParentComments) {
+ if (parentComment.isDeleted()) continue
+
cc.push(parentComment.Account.Actor.url)
}
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index 8bdcf6417c..e2fa061e88 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -80,7 +80,8 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, t: Transacti
// Add the actor that commented too
actorsInvolvedInComment.push(byActor)
- const parentsCommentActors = threadParentComments.map(c => c.Account.Actor)
+ const parentsCommentActors = threadParentComments.filter(c => !c.isDeleted())
+ .map(c => c.Account.Actor)
let audience: ActivityAudience
if (isOrigin) {