summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-08-10 00:28:23 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-08-10 00:28:23 +0200
commit9714486447cd213c02540a7e48cd22dfac6e5ab9 (patch)
tree58349c82ac43db0c8069fd1783ae4a0117b77dcf
parentSupport editing space children (diff)
downloadnheko-9714486447cd213c02540a7e48cd22dfac6e5ab9.tar.xz
Hide uneditable spaces from menu
-rw-r--r--src/timeline/CommunitiesModel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp
index 6d60c2b9..adc52c7b 100644
--- a/src/timeline/CommunitiesModel.cpp
+++ b/src/timeline/CommunitiesModel.cpp
@@ -751,7 +751,13 @@ CommunitiesModel::spaceChildrenListFromIndex(QString room, int idx) const
         const auto &e = spaceOrder_.tree[i];
         if (e.depth == spaceOrder_.tree[begin].depth && spaces_.count(e.id)) {
             bool canSendChild = Permissions(e.id).canChange(qml_mtx_events::SpaceChild);
-            auto spaceId      = e.id.toStdString();
+            // For now hide the space, if we can't send any child, since then the only allowed
+            // action would be removing a space and even that only works if it currently only has a
+            // parent set in the child.
+            if (!canSendChild)
+                continue;
+
+            auto spaceId = e.id.toStdString();
             auto child =
               cache::client()->getStateEvent<mtx::events::state::space::Child>(spaceId, room_);
             auto parent =