diff --git a/web/ts/api/chat.ts b/web/ts/api/chat.ts index fcbce6ecd..7bf8753c7 100644 --- a/web/ts/api/chat.ts +++ b/web/ts/api/chat.ts @@ -92,6 +92,13 @@ export class ChatMessageArray { this.messages = filtered; } + approveReply(m: ChatMessage) { + const base = this.messages.find((msg) => msg.ID === m.replyTo.Int64); + const filtered = base.replies.filter((msg) => msg.ID !== m.ID); + filtered.push(Object.assign(new ChatMessage(), m)); + base.replies = filtered; + } + retract(msg: ChatMessage, isAdmin: boolean) { if (isAdmin) { this.messages.find((m) => m.ID === msg.ID).visible = false; diff --git a/web/ts/components/chat.ts b/web/ts/components/chat.ts index e260f88c2..1b187e3f4 100644 --- a/web/ts/components/chat.ts +++ b/web/ts/components/chat.ts @@ -232,7 +232,8 @@ export function chatContext(streamId: number, user: User, isRecording: boolean): handleApprove(msg: ChatMessage) { this.preprocessors.forEach((f) => f(msg, this.user)); - this.messages.approve(msg); + if (msg.replyTo.Valid) this.messages.approveReply(msg); + else this.messages.approve(msg); }, handleRetract(msg: ChatMessage) {