From 952fdd04c18375dc41ca27da333b189f6c270374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 20 Aug 2021 10:04:40 +0200 Subject: [PATCH] Fix call tiles on the bubble layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- res/css/views/rooms/_EventBubbleTile.scss | 1 + src/components/views/rooms/EventTile.tsx | 8 +++++++- src/utils/EventUtils.ts | 11 ++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/res/css/views/rooms/_EventBubbleTile.scss b/res/css/views/rooms/_EventBubbleTile.scss index c6170bf7c0..f270146606 100644 --- a/res/css/views/rooms/_EventBubbleTile.scss +++ b/res/css/views/rooms/_EventBubbleTile.scss @@ -264,6 +264,7 @@ limitations under the License. } .mx_EventTile.mx_EventTile_bubbleContainer[data-layout=bubble], +.mx_EventTile.mx_EventTile_leftAlignedBubble[data-layout=bubble], .mx_EventTile.mx_EventTile_info[data-layout=bubble], .mx_EventListSummary[data-layout=bubble][data-expanded=false] { --backgroundColor: transparent; diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index c97b28b368..dd954e46ce 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -857,7 +857,12 @@ export default class EventTile extends React.Component { render() { const msgtype = this.props.mxEvent.getContent().msgtype; const eventType = this.props.mxEvent.getType() as EventType; - const { tileHandler, isBubbleMessage, isInfoMessage } = getEventDisplayInfo(this.props.mxEvent); + const { + tileHandler, + isBubbleMessage, + isInfoMessage, + isLeftAlignedBubbleMessage, + } = getEventDisplayInfo(this.props.mxEvent); // This shouldn't happen: the caller should check we support this type // before trying to instantiate us @@ -879,6 +884,7 @@ export default class EventTile extends React.Component { const isEditing = !!this.props.editState; const classes = classNames({ mx_EventTile_bubbleContainer: isBubbleMessage, + mx_EventTile_leftAlignedBubble: isLeftAlignedBubbleMessage, mx_EventTile: true, mx_EventTile_isEditing: isEditing, mx_EventTile_info: isInfoMessage, diff --git a/src/utils/EventUtils.ts b/src/utils/EventUtils.ts index 7aef05c523..d5a5c416ba 100644 --- a/src/utils/EventUtils.ts +++ b/src/utils/EventUtils.ts @@ -103,6 +103,7 @@ export function getEventDisplayInfo(mxEvent: MatrixEvent): { isInfoMessage: boolean; tileHandler: string; isBubbleMessage: boolean; + isLeftAlignedBubbleMessage: boolean; } { const content = mxEvent.getContent(); const msgtype = content.msgtype; @@ -118,12 +119,16 @@ export function getEventDisplayInfo(mxEvent: MatrixEvent): { (eventType === EventType.RoomEncryption) || (tileHandler === "messages.MJitsiWidgetEvent") ); + const isLeftAlignedBubbleMessage = ( + !isBubbleMessage && + eventType === EventType.CallInvite + ); let isInfoMessage = ( !isBubbleMessage && + !isLeftAlignedBubbleMessage && eventType !== EventType.RoomMessage && eventType !== EventType.Sticker && - eventType !== EventType.RoomCreate && - eventType !== EventType.CallInvite + eventType !== EventType.RoomCreate ); // If we're showing hidden events in the timeline, we should use the @@ -137,5 +142,5 @@ export function getEventDisplayInfo(mxEvent: MatrixEvent): { isInfoMessage = true; } - return { tileHandler, isInfoMessage, isBubbleMessage }; + return { tileHandler, isInfoMessage, isBubbleMessage, isLeftAlignedBubbleMessage }; }