Change the behaviour when clicking on a space

- When click on a space the space home page is shown, unless the current room is also a member of the new space
- When changing to friends or global the first is entered
- The global now only contains rooms that are not part of a space
- Global is now home
This commit is contained in:
James Graham
2024-01-31 20:33:36 +00:00
parent 79cf399bf5
commit 4746401bec
6 changed files with 45 additions and 8 deletions

View File

@@ -361,7 +361,7 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
return room->isSpace();
}
if (role == IsChildSpaceRole) {
return SpaceHierarchyCache::instance().isChildSpace(room->id());
return SpaceHierarchyCache::instance().isChild(room->id());
}
if (role == ReplacementIdRole) {
return room->successorId();

View File

@@ -106,7 +106,10 @@ bool SortFilterRoomListModel::filterAcceptsRow(int source_row, const QModelIndex
}
if (m_activeSpaceId.isEmpty()) {
return acceptRoom;
if (!SpaceHierarchyCache::instance().isChild(sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::RoomIdRole).toString())) {
return acceptRoom;
}
return false;
} else {
const auto &rooms = SpaceHierarchyCache::instance().getRoomListForSpace(m_activeSpaceId, false);
return std::find(rooms.begin(), rooms.end(), sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::RoomIdRole).toString())