Don't try opening last room when this room is not available

When switching connection to a connection that is not loaded or where we have left the last room, trying to resolve it will not do anything, causing the room from the previous connection to stay open
This commit is contained in:
Tobias Fella
2026-02-20 15:17:23 +01:00
committed by Tobias Fella
parent 7e3db19ead
commit aaaaf91248

View File

@@ -537,13 +537,14 @@ void RoomManager::setCurrentSpace(const QString &spaceId, bool goToLastUsedRoom)
LastRoomBlocker blocker(this);
// We can't have empty keys in KConfig, so it's stored as "Home":
if (const auto &lastRoom = m_lastRoomConfig.readEntry(spaceId.isEmpty() ? u"Home"_s : spaceId, QString()); !lastRoom.isEmpty()) {
if (const auto &lastRoom = m_lastRoomConfig.readEntry(spaceId.isEmpty() ? u"Home"_s : spaceId, QString());
!lastRoom.isEmpty() && m_connection->room(lastRoom)) {
resolveResource(lastRoom, "no_join"_L1);
return;
}
// If no last room was opened, go to the space home:
if (!spaceId.isEmpty() && spaceId != u"DM"_s) {
if (!spaceId.isEmpty() && spaceId != u"DM"_s && m_connection->room(spaceId)) {
resolveResource(spaceId, "no_join"_L1);
return;
}