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

@@ -74,6 +74,11 @@ void SpaceHierarchyCache::removeSpaceFromHierarchy(Quotient::Room *room)
}
}
bool SpaceHierarchyCache::isSpaceChild(const QString &spaceId, const QString &roomId)
{
return getRoomListForSpace(spaceId, false).contains(roomId);
}
QList<QString> &SpaceHierarchyCache::getRoomListForSpace(const QString &spaceId, bool updateCache)
{
if (updateCache) {
@@ -82,11 +87,11 @@ QList<QString> &SpaceHierarchyCache::getRoomListForSpace(const QString &spaceId,
return m_spaceHierarchy[spaceId];
}
bool SpaceHierarchyCache::isChildSpace(const QString &spaceId) const
bool SpaceHierarchyCache::isChild(const QString &roomId) const
{
const auto childrens = m_spaceHierarchy.values();
for (const auto &children : childrens) {
if (children.contains(spaceId)) {
if (children.contains(roomId)) {
return true;
}
}