do not switch away from home space on notification

If the preference "Show all Rooms in Home" is selected element should
not switch away from the home space when clicking a notification for a
room in some other space.
With this change one stays in the home space when the said preference is
active.
fixes #5180

Signed-off-by: Michael Loipführer <milo@sft.lol>
This commit is contained in:
Michael Loipführer 2022-04-23 00:06:18 +02:00
parent 2839d1467f
commit 6b9b688072
2 changed files with 3 additions and 1 deletions

1
changelog.d/5827.bugfix Normal file
View File

@ -0,0 +1 @@
Do not switch away from home space on notification when "Show all Rooms in Home" is selected.

View File

@ -207,7 +207,8 @@ class TimelineViewModel @AssistedInject constructor(
appStateHandler.getCurrentRoomGroupingMethod()?.space().let { currentSpace ->
val currentRoomSummary = room.roomSummary() ?: return@let
// nothing we are good
if (currentSpace == null || !currentRoomSummary.flattenParentIds.contains(currentSpace.roomId)) {
if ((currentSpace == null && !vectorPreferences.prefSpacesShowAllRoomInHome())
|| (currentSpace != null && !currentRoomSummary.flattenParentIds.contains(currentSpace.roomId))) {
// take first one or switch to home
appStateHandler.setCurrentSpace(
currentRoomSummary