Skip to content

Commit

Permalink
change the way top level spaces are determined
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz committed Jul 27, 2024
1 parent 909c7f9 commit f826694
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions commet/lib/client/matrix/matrix_space.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,12 @@ class MatrixSpace extends Space {

@override
bool get isTopLevel {
var parents = _matrixRoom.spaceParents;

bool anyParentContainsRoom = false;
for (var parent in parents) {
if (parent.roomId == null) {
continue;
}

var room = _matrixClient.getRoomById(parent.roomId!);
if (room == null) {
continue;
}

var contains =
room.spaceChildren.any((child) => child.roomId == _matrixRoom.id);
if (contains) {
anyParentContainsRoom = true;
break;
for (var room in _matrixClient.rooms.where((r) => r.isSpace)) {
if (room.spaceChildren.any((child) => child.roomId == _matrixRoom.id)) {
return false;
}
}

return !anyParentContainsRoom;
return true;
}

MatrixSpace(
Expand Down

0 comments on commit f826694

Please sign in to comment.