Canonical Parent

So the original space parent and child stuff was technically a bit naughty in that it allowed multiple rooms to be set as the canonical parent. Because while a room can have multiple parents only one should be canonical. This adds the following:
- When adding a child or parent there is an extra check to select if the new parent should be canonical
- Any parent can be selected as the canonical one from the room settings
- All functions ensure that there is only ever one canonical parent by ensuring all others are false when a new one is set.
This commit is contained in:
James Graham
2023-10-13 12:00:47 +00:00
parent fe70e2773f
commit e480299563
5 changed files with 137 additions and 31 deletions

View File

@@ -157,12 +157,12 @@ Kirigami.Page {
}, {
title: i18nc("@title", "Create a Child")
})
dialog.addChild.connect((childId, setChildParent) => {
dialog.addChild.connect((childId, setChildParent, canonical) => {
// We have to get a room object from the connection as we may not
// be adding to the top level parent.
let parent = root.currentRoom.connection.room(parentId)
if (parent) {
parent.addChild(childId, setChildParent)
parent.addChild(childId, setChildParent, canonical)
}
})
dialog.newChild.connect(childName => {spaceChildrenModel.addPendingChild(childName)})