From 31573b35995efab127ad1fa6c7d98f72ddfd8c27 Mon Sep 17 00:00:00 2001
From: RMidhunSuresh <hi@midhun.dev>
Date: Tue, 7 Dec 2021 11:33:55 +0530
Subject: [PATCH] Render reply

---
 .../web/ui/session/room/timeline/TextMessageView.js  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/platform/web/ui/session/room/timeline/TextMessageView.js b/src/platform/web/ui/session/room/timeline/TextMessageView.js
index c1674501..2f8d10a7 100644
--- a/src/platform/web/ui/session/room/timeline/TextMessageView.js
+++ b/src/platform/web/ui/session/room/timeline/TextMessageView.js
@@ -35,6 +35,18 @@ export class TextMessageView extends BaseMessageView {
             }
             container.appendChild(time);
         });
+        t.mapSideEffect(vm => vm.replyPreviewBody, ({ body, sender, avatar }) => {
+            if (!body) {
+                return;
+            }
+            const replyContainer = t.blockquote([
+                t.a({ className: "link", href: "#" }, "In reply to"),
+                t.a({ className: "pill", href: "#" }, [tag.div({class: `avatar size-12 usercolor${avatar.colorNumber}`}, text(avatar.initial)), sender]), t.br()]);
+            for (const part of body.parts) {
+                replyContainer.appendChild(renderPart(part));
+            }
+            container.insertBefore(replyContainer, container.firstChild);
+        });
         return container;
     }
 }