Fix incorrect conditions for showing avatar

This commit is contained in:
Danila Fedorin 2021-07-28 16:17:25 -07:00
parent e2ad589aa3
commit 28248722a3

View File

@ -52,10 +52,10 @@ export class BaseMessageView extends TemplateView {
// as the avatar or sender doesn't need any bindings or event handlers. // as the avatar or sender doesn't need any bindings or event handlers.
// don't use `t` from within the side-effect callback // don't use `t` from within the side-effect callback
t.mapSideEffect(vm => vm.isContinuation, (isContinuation, wasContinuation) => { 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_messageAvatar"));
li.removeChild(li.querySelector(".Timeline_messageSender")); 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(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild);
li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), 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 // but that adds a comment node to all messages without reactions
let reactionsView = null; let reactionsView = null;
t.mapSideEffect(vm => vm.reactions, reactions => { t.mapSideEffect(vm => vm.reactions, reactions => {
if (reactions && !reactionsView && !this._disabled) { if (reactions && !this._disabled && !reactionsView) {
reactionsView = new ReactionsView(vm.reactions); reactionsView = new ReactionsView(vm.reactions);
this.addSubView(reactionsView); this.addSubView(reactionsView);
li.appendChild(mountView(reactionsView)); li.appendChild(mountView(reactionsView));
} else if (!reactions && reactionsView && !this._disabled) { } else if (!reactions && reactionsView) {
li.removeChild(reactionsView.root()); li.removeChild(reactionsView.root());
reactionsView.unmount(); reactionsView.unmount();
this.removeSubView(reactionsView); this.removeSubView(reactionsView);