From 4411498057ef3fa5055e439ad2da2a159701a583 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 25 Apr 2021 09:33:44 +0100 Subject: [PATCH 1/2] Fix add existing to space dialog no longer showing rooms for public spaces --- .../views/dialogs/AddExistingToSpaceDialog.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx index 0f58a624f3..84eb8ba5ef 100644 --- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx +++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx @@ -68,9 +68,15 @@ const AddExistingToSpaceDialog: React.FC = ({ matrixClient: cli, space, if (room !== space && room !== selectedSpace && !existingSubspacesSet.has(room)) { arr[0].push(room); } - } else if (!existingRoomsSet.has(room) && joinRule !== "public") { - // Only show DMs for non-public spaces as they make very little sense in spaces other than "Just Me" ones. - arr[DMRoomMap.shared().getUserIdForRoomId(room.roomId) ? 2 : 1].push(room); + } else if (!existingRoomsSet.has(room)) { + if (DMRoomMap.shared().getUserIdForRoomId(room.roomId)) { + // Only show DMs for non-public spaces as they make very little sense in spaces other than "Just Me" ones. + if (joinRule !== "public") { + arr[2].push(room); + } + } else { + arr[1].push(room); + } } return arr; }, [[], [], []]); From 1c7d68bb16e18a0cbaae673c337bf33a1db74333 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 25 Apr 2021 09:35:18 +0100 Subject: [PATCH 2/2] invert and outdent --- .../views/dialogs/AddExistingToSpaceDialog.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx index 84eb8ba5ef..dd4973d259 100644 --- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx +++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx @@ -69,13 +69,11 @@ const AddExistingToSpaceDialog: React.FC = ({ matrixClient: cli, space, arr[0].push(room); } } else if (!existingRoomsSet.has(room)) { - if (DMRoomMap.shared().getUserIdForRoomId(room.roomId)) { - // Only show DMs for non-public spaces as they make very little sense in spaces other than "Just Me" ones. - if (joinRule !== "public") { - arr[2].push(room); - } - } else { + if (!DMRoomMap.shared().getUserIdForRoomId(room.roomId)) { arr[1].push(room); + } else if (joinRule !== "public") { + // Only show DMs for non-public spaces as they make very little sense in spaces other than "Just Me" ones. + arr[2].push(room); } } return arr;