Extract the space selection logic from setCurrentRoom and use it for setting lastRoomConfig too.

If a setCurrentRoom call changed the active space at the end of its execution, the new room's ID ended up still being written to the old space's lastRoomConfig.

By extracting this space selection logic into a helper function, we can now calculate this value earlier and use it as the space id when writing lastRoomConfig.
This commit is contained in:
Veres Károly
2025-12-26 04:11:50 +01:00
committed by Joshua Goins
parent aa823c7629
commit 68b00b9fc5
2 changed files with 60 additions and 46 deletions

View File

@@ -373,6 +373,15 @@ private:
void setCurrentRoom(const QString &roomId);
/**
* @brief Find the most appropriate space for the currently selected room
*
* Should be used to figure out what space to switch to after a room change.
*
* @return The Space ID that the currently set room should be displayed as part of. (or "DM" for DM and "" for Home)
*/
QString findSpaceIdForCurrentRoom() const;
// Space ID, "DM", or empty string
void setCurrentSpace(const QString &spaceId, bool setRoom = true);