Do not remove reply preview

This commit is contained in:
RMidhunSuresh 2021-12-10 12:40:55 +05:30
parent 99f4eb6843
commit 3aa29cfc65
2 changed files with 6 additions and 4 deletions

View file

@ -28,7 +28,8 @@ export class ReplyPreviewView extends TemplateView {
_renderError({ error, avatar, senderName }) {
const errorMessage = this._getErrorMessage(error);
const children = [tag.span({ className: "statusMessage" }, errorMessage), tag.br()];
const reply = avatar && senderName? this._renderReplyHeader(avatar, senderName, children) : tag.blockquote(children);
const reply = avatar && senderName ? this._renderReplyHeader(avatar, senderName, children) :
tag.blockquote({ className: "ReplyPreviewView" }, children);
return reply;
}
@ -52,8 +53,9 @@ export class ReplyPreviewView extends TemplateView {
return reply;
}
_renderReplyHeader(avatar, displayName, children) {
return tag.blockquote([
_renderReplyHeader(avatar, displayName, children = []) {
return tag.blockquote({ className: "ReplyPreviewView" },
[
tag.a({ className: "link", href: "#" }, "In reply to"),
tag.a({ className: "pill", href: "#" }, [renderStaticAvatar(avatar, 12), displayName]),
tag.br(),

View file

@ -29,7 +29,7 @@ export class TextMessageView extends BaseMessageView {
}, t.mapView(vm => vm.replyPreviewBody, reply => reply ? new ReplyPreviewView(reply): null));
t.mapSideEffect(vm => vm.body, body => {
while (container.lastChild && container.lastChild.tagName !== "BLOCKQUOTE") {
while (container.lastChild && container.lastChild.className !== "ReplyPreviewView") {
container.removeChild(container.lastChild);
}
for (const part of body.parts) {