summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-12-27 01:40:03 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-12-27 01:40:25 +0100
commitf98b289ba2f8241ebe33da3e4aac9a6e71ca5c3e (patch)
tree1ab2131f42ed214d36f345b49bdc48229d7530b5 /src/timeline/RoomlistModel.cpp
parentUpdate translations (diff)
downloadnheko-f98b289ba2f8241ebe33da3e4aac9a6e71ca5c3e.tar.xz
Show invite reason in the UI (hidden by default)
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 82b3fc3d..827cbed1 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -723,6 +723,13 @@ RoomlistModel::getRoomPreviewById(QString roomid) const
         if (invites.contains(roomid)) {
             i                 = invites.value(roomid);
             preview.isInvite_ = true;
+
+            auto member = cache::client()->getInviteMember(roomid.toStdString(),
+                                                           http::client()->user_id().to_string());
+
+            if (member) {
+                preview.reason_ = QString::fromStdString(member->reason);
+            }
         } else {
             i                 = previewedRooms.value(roomid);
             preview.isInvite_ = false;
@@ -769,6 +776,13 @@ RoomlistModel::setCurrentRoom(const QString &roomid)
         if (invites.contains(roomid)) {
             i           = invites.value(roomid);
             p.isInvite_ = true;
+
+            auto member = cache::client()->getInviteMember(roomid.toStdString(),
+                                                           http::client()->user_id().to_string());
+
+            if (member) {
+                p.reason_ = QString::fromStdString(member->reason);
+            }
         } else {
             i           = previewedRooms.value(roomid);
             p.isInvite_ = false;