Fix add comment in threads with deleted comments
This commit is contained in:
parent
5db4545cd2
commit
6cb5564490
|
@ -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)
|
||||
|
|
|
@ -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 ])
|
||||
|
||||
if (this.comment.account) {
|
||||
this.commentAccount = new Account(this.comment.account)
|
||||
this.getUserIfNeeded(this.commentAccount)
|
||||
} else {
|
||||
this.comment.account = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue