From 28248722a33d2dc29e3a6deddeec0277b07199fa Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 28 Jul 2021 16:17:25 -0700 Subject: [PATCH] Fix incorrect conditions for showing avatar --- .../web/ui/session/room/timeline/BaseMessageView.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platform/web/ui/session/room/timeline/BaseMessageView.js b/src/platform/web/ui/session/room/timeline/BaseMessageView.js index 018b455b..a27e9bef 100644 --- a/src/platform/web/ui/session/room/timeline/BaseMessageView.js +++ b/src/platform/web/ui/session/room/timeline/BaseMessageView.js @@ -52,10 +52,10 @@ export class BaseMessageView extends TemplateView { // as the avatar or sender doesn't need any bindings or event handlers. // don't use `t` from within the side-effect callback t.mapSideEffect(vm => vm.isContinuation, (isContinuation, wasContinuation) => { - if (isContinuation && wasContinuation === false && !this._disabled) { + if (isContinuation && !this._disabled && wasContinuation === false) { li.removeChild(li.querySelector(".Timeline_messageAvatar")); li.removeChild(li.querySelector(".Timeline_messageSender")); - } else if (!isContinuation && !this._disabled) { + } else if (!isContinuation || this._disabled) { li.insertBefore(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild); li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), li.firstChild); } @@ -64,11 +64,11 @@ export class BaseMessageView extends TemplateView { // but that adds a comment node to all messages without reactions let reactionsView = null; t.mapSideEffect(vm => vm.reactions, reactions => { - if (reactions && !reactionsView && !this._disabled) { + if (reactions && !this._disabled && !reactionsView) { reactionsView = new ReactionsView(vm.reactions); this.addSubView(reactionsView); li.appendChild(mountView(reactionsView)); - } else if (!reactions && reactionsView && !this._disabled) { + } else if (!reactions && reactionsView) { li.removeChild(reactionsView.root()); reactionsView.unmount(); this.removeSubView(reactionsView);