summary refs log tree commit diff
diff options
context:
space:
mode:
authorLcsTen <lcs10.twinoid@gmail.com>2023-03-09 18:47:26 +0100
committerLcsTen <lcs10.twinoid@gmail.com>2023-03-11 13:19:04 +0100
commit9bd7f98528cffc70d35b29453a36426120a069a2 (patch)
tree00470fdf4540ae825e563fa5d2fb2b09ceb83b53
parentUpdate cirrus build to work around brew bundle issue (diff)
downloadnheko-9bd7f98528cffc70d35b29453a36426120a069a2.tar.xz
Don't show inaccessible private rooms in spaces
-rw-r--r--src/timeline/RoomlistModel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 455ea94f..cb23a12d 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -1100,6 +1100,15 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
                       .toBool();
         }
 
+        // If it is a preview but it can't be fetched, it is probably an inaccessible private room.
+        // Hide it if the user isn't an admin.
+        auto index = sourceModel()->index(sourceRow, 0);
+        if (sourceModel()->data(index, RoomlistModel::IsPreview).toBool() &&
+            !sourceModel()->data(index, RoomlistModel::IsPreviewFetched).toBool() &&
+            !Permissions(filterStr).canChange(qml_mtx_events::SpaceChild)) {
+            return false;
+        }
+
         return true;
     } else {
         return true;