Fix add comment in threads with deleted comments

This commit is contained in:
Chocobozzz 2020-03-20 14:43:12 +01:00
parent 5db4545cd2
commit 6cb5564490
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 13 additions and 5 deletions

View File

@ -57,7 +57,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
if (this.parentComment) { if (this.parentComment) {
const mentions = this.parentComments 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) .map(c => '@' + c.by)
const mentionsSet = new Set(mentions) const mentionsSet = new Set(mentions)

View File

@ -125,7 +125,12 @@ export class VideoCommentComponent implements OnInit, OnChanges {
const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true) const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true)
this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html) this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html)
this.newParentComments = this.parentComments.concat([ this.comment ]) 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
}
} }
} }

View File

@ -183,7 +183,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
// Mark the comment as deleted // Mark the comment as deleted
this.softDeleteComment(commentToDelete) 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) err => this.notifier.error(err.message)

View File

@ -32,6 +32,8 @@ function getVideoCommentAudience (
// Send to actors we reply to // Send to actors we reply to
for (const parentComment of threadParentComments) { for (const parentComment of threadParentComments) {
if (parentComment.isDeleted()) continue
cc.push(parentComment.Account.Actor.url) cc.push(parentComment.Account.Actor.url)
} }

View File

@ -80,7 +80,8 @@ async function sendCreateVideoComment (comment: MCommentOwnerVideo, t: Transacti
// Add the actor that commented too // Add the actor that commented too
actorsInvolvedInComment.push(byActor) 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 let audience: ActivityAudience
if (isOrigin) { if (isOrigin) {