From 99f4eb6843cb9b973d3e12df3d28d7bd41759f5d Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 9 Dec 2021 22:59:02 +0530 Subject: [PATCH] Minimize manual dom manipulation where possible --- .../web/ui/session/room/timeline/ReplyPreviewView.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js b/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js index dbb07579..7dbc9b0a 100644 --- a/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js +++ b/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js @@ -27,8 +27,8 @@ export class ReplyPreviewView extends TemplateView { _renderError({ error, avatar, senderName }) { const errorMessage = this._getErrorMessage(error); - const reply = avatar && senderName? this._renderReplyHeader(avatar, senderName) : tag.blockquote(); - reply.append(tag.span({ className: "statusMessage" }, errorMessage), tag.br()); + const children = [tag.span({ className: "statusMessage" }, errorMessage), tag.br()]; + const reply = avatar && senderName? this._renderReplyHeader(avatar, senderName, children) : tag.blockquote(children); return reply; } @@ -52,10 +52,12 @@ export class ReplyPreviewView extends TemplateView { return reply; } - _renderReplyHeader(avatar, displayName) { + _renderReplyHeader(avatar, displayName, children) { return tag.blockquote([ tag.a({ className: "link", href: "#" }, "In reply to"), - tag.a({ className: "pill", href: "#" }, [renderStaticAvatar(avatar, 12), displayName]), tag.br() + tag.a({ className: "pill", href: "#" }, [renderStaticAvatar(avatar, 12), displayName]), + tag.br(), + ...children ]); } }