From 0a4e95a1db11c45e3880eee4982753a9faf0a3da Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Tue, 13 Jul 2021 02:57:16 +0200
Subject: [PATCH] Don't allow switching to current room

fixes #634
---
 src/timeline/RoomlistModel.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 1c1057e1b..cb8006990 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -602,6 +602,10 @@ RoomlistModel::leave(QString roomid)
 void
 RoomlistModel::setCurrentRoom(QString roomid)
 {
+        if ((currentRoom_ && currentRoom_->roomId() == roomid) ||
+            (currentRoomPreview_ && currentRoomPreview_->roomid() == roomid))
+                return;
+
         nhlog::ui()->debug("Trying to switch to: {}", roomid.toStdString());
         if (models.contains(roomid)) {
                 currentRoom_ = models.value(roomid);
-- 
GitLab