diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-11-03 22:35:54 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-11-03 22:35:54 +0100 |
commit | 1a163f49e21ca64704460d292f1bf665be7e6c76 (patch) | |
tree | 2a0186e09b12a599ba46feb70fba59c7490875d0 /src/timeline | |
parent | Fix copyright order (diff) | |
download | nheko-1a163f49e21ca64704460d292f1bf665be7e6c76.tar.xz |
Fix unjoinable invites on mobile as well as unclickable previews
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/RoomlistModel.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index c5bbd83c..179c63af 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -609,6 +609,12 @@ RoomlistModel::setCurrentRoom(QString roomid) (currentRoomPreview_ && currentRoomPreview_->roomid() == roomid)) return; + if (roomid.isEmpty()) { + currentRoom_ = nullptr; + currentRoomPreview_ = {}; + emit currentRoomChanged(); + } + nhlog::ui()->debug("Trying to switch to: {}", roomid.toStdString()); if (models.contains(roomid)) { currentRoom_ = models.value(roomid); @@ -635,10 +641,24 @@ RoomlistModel::setCurrentRoom(QString roomid) p.roomTopic_ = QString::fromStdString(i->topic); p.roomAvatarUrl_ = QString::fromStdString(i->avatar_url); currentRoomPreview_ = std::move(p); + nhlog::ui()->debug("Switched to (preview): {}", + currentRoomPreview_->roomid_.toStdString()); + } else { + p.roomid_ = roomid; + currentRoomPreview_ = p; + nhlog::ui()->debug("Switched to (empty): {}", + currentRoomPreview_->roomid_.toStdString()); } emit currentRoomChanged(); - nhlog::ui()->debug("Switched to: {}", roomid.toStdString()); + } else { + currentRoom_ = nullptr; + + RoomPreview p; + p.roomid_ = roomid; + currentRoomPreview_ = std::move(p); + emit currentRoomChanged(); + nhlog::ui()->debug("Switched to (empty): {}", roomid.toStdString()); } } |