From b97b9da14aaef14d171a9d25f5d67cc55cf65e9e Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 6 Aug 2021 20:51:39 +0530 Subject: [PATCH] Link to member-panel from avatar Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/tiles/BaseMessageTile.js | 4 ++++ src/platform/web/ui/session/room/timeline/BaseMessageView.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/tiles/BaseMessageTile.js b/src/domain/session/room/timeline/tiles/BaseMessageTile.js index 71c709b8..9bd9f0ea 100644 --- a/src/domain/session/room/timeline/tiles/BaseMessageTile.js +++ b/src/domain/session/room/timeline/tiles/BaseMessageTile.js @@ -41,6 +41,10 @@ export class BaseMessageTile extends SimpleTile { return this._entry.sender; } + get memberPanelLink() { + return `${this.urlCreator.urlUntilSegment("room")}/member/${this.sender}`; + } + // Avatar view model contract get avatarColorNumber() { return getIdentifierColorNumber(this._entry.sender); diff --git a/src/platform/web/ui/session/room/timeline/BaseMessageView.js b/src/platform/web/ui/session/room/timeline/BaseMessageView.js index c5d860f2..b6b257cd 100644 --- a/src/platform/web/ui/session/room/timeline/BaseMessageView.js +++ b/src/platform/web/ui/session/room/timeline/BaseMessageView.js @@ -42,6 +42,7 @@ export class BaseMessageView extends TemplateView { // should be after body as it is overlayed on top t.button({className: "Timeline_messageOptions"}, "⋯"), ]); + const avatar = t.a({href: vm.memberPanelLink}, [renderStaticAvatar(vm, 30, "Timeline_messageAvatar")]); // given that there can be many tiles, we don't add // unneeded DOM nodes in case of a continuation, and we add it // with a side-effect binding to not have to create sub views, @@ -52,7 +53,7 @@ export class BaseMessageView extends TemplateView { li.removeChild(li.querySelector(".Timeline_messageAvatar")); li.removeChild(li.querySelector(".Timeline_messageSender")); } else if (!isContinuation) { - li.insertBefore(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild); + li.insertBefore(avatar, li.firstChild); li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), li.firstChild); } });