From c9ee604cf3ef1320e57c47ae4ae4351d3db364c4 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 16 Apr 2021 10:33:16 -0400 Subject: [PATCH] Show inviter as subtitle for room list invites Also fixes the centering of the enveloppe icon for invited rooms with a subtitle. --- src/gui/MainPane/RoomDelegate.qml | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/gui/MainPane/RoomDelegate.qml b/src/gui/MainPane/RoomDelegate.qml index e7b9aca0..9be6ce94 100644 --- a/src/gui/MainPane/RoomDelegate.qml +++ b/src/gui/MainPane/RoomDelegate.qml @@ -80,17 +80,6 @@ HTile { localUnreads: model.local_unreads } - HIcon { - svgName: "invite-received" - colorize: theme.colors.alertBackground - small: room.compact - visible: invited - - Layout.maximumWidth: invited ? implicitWidth : 0 - - Behavior on Layout.maximumWidth { HNumberAnimation {} } - } - TitleRightInfoLabel { tile: room color: theme.mainPane.listView.room.lastEventDate @@ -106,6 +95,18 @@ HTile { lastEvent && lastEvent.event_type === "RoomMessageEmote" text: { + // If this is a room invite with no last event to show, + // and the room name isn't just the inviter's name + if ( + ! lastEvent && model.inviter_id && ( + ! model.display_name || + model.inviter_name !== model.display_name + ) + ) + return utils.coloredNameHtml( + model.inviter_name, model.inviter_id, + ) + if (! lastEvent) return "" const ev_type = lastEvent.event_type @@ -135,6 +136,17 @@ HTile { } } } + + HIcon { + svgName: "invite-received" + colorize: theme.colors.alertBackground + small: room.compact + visible: invited + + Layout.maximumWidth: invited ? implicitWidth : 0 + + Behavior on Layout.maximumWidth { HNumberAnimation {} } + } } contextMenu: HMenu {