Make sure user has permission to add space child
This commit is contained in:
parent
4a0ee3665f
commit
aa5d09407e
2 changed files with 5 additions and 4 deletions
|
|
@ -815,7 +815,6 @@ class ChatListController extends State<ChatList>
|
|||
&&
|
||||
selectedRoomIds
|
||||
.map((id) => Matrix.of(context).client.getRoomById(id))
|
||||
// .where((e) => !(e?.isPangeaClass ?? true))
|
||||
.every((e) => r.canAddAsParentOf(e)),
|
||||
//Pangea#
|
||||
)
|
||||
|
|
|
|||
|
|
@ -128,13 +128,15 @@ extension ChildrenAndParentsRoomExtension on Room {
|
|||
return childIds;
|
||||
}
|
||||
|
||||
// Checks if can add chat as child
|
||||
// Or whether potential child space is ancestor of this
|
||||
// Checks if has permissions to add child to space
|
||||
// And whether potential child space is ancestor of this
|
||||
bool _canAddAsParentOf(Room? child) {
|
||||
if (child == null || !child.isSpace) {
|
||||
return _canIAddSpaceChild(child);
|
||||
}
|
||||
if (id == child.id) return false;
|
||||
return !child._allSpaceChildRoomIds.contains(id);
|
||||
return _isRoomAdmin &&
|
||||
child._isRoomAdmin &&
|
||||
!child._allSpaceChildRoomIds.contains(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue