summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-22 11:23:16 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-22 11:23:16 +0200
commitd307f24adf346ec3fe41d40a599db98d7eb435cf (patch)
tree43dffe58313eafb03592f5dfac3c6d5507278d8f /src/timeline/RoomlistModel.cpp
parentFix emoji in new RoomList (diff)
downloadnheko-d307f24adf346ec3fe41d40a599db98d7eb435cf.tar.xz
Fix leaving rooms
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 6d741322..28c3cf46 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -227,6 +227,17 @@ RoomlistModel::sync(const mtx::responses::Rooms &rooms)
                         }
                 }
         }
+
+        for (const auto &[room_id, room] : rooms.leave) {
+                (void)room;
+                auto idx = this->roomidToIndex(QString::fromStdString(room_id));
+                if (idx != -1) {
+                        beginRemoveRows(QModelIndex(), idx, idx);
+                        roomids.erase(roomids.begin() + idx);
+                        models.remove(QString::fromStdString(room_id));
+                        endRemoveRows();
+                }
+        }
 }
 
 void