Only offer joined rooms in the forward and share pickers (#6255)

* Initial plan

* Offer only joined rooms in destination pickers

Co-authored-by: Velin92 <34335419+Velin92@users.noreply.github.com>

* Clean whitespace in share picker test

Co-authored-by: Velin92 <34335419+Velin92@users.noreply.github.com>

* Restrict the shared picker room list to joined rooms

The alternate room summary provider, which backs the forward, share and
Add rooms pickers and global search, now always includes the SDK's
joined filter in its base filter. This replaces the per-call joinedOnly
flags, so Add rooms no longer offers invited rooms or spaces and no
screen can forget the flag.

A filter set before the provider has its room list is now applied once
the list is set, instead of being reset to the default. The share picker
hit this on a cold launch from the share extension.

The forward and share pickers also hide upgraded rooms, matching the
Suggestions section. The SDK has no filter for these.

Also registers the share picker's test file in the project, fixes the
blank-line indentation SwiftFormat flagged, and re-records the picker
snapshots without the upgraded room.

* Check room membership for forwarding suggestions and search breadcrumbs

RoomSummary now has isJoined, built from the room's membership. The
forwarding suggestions and the search breadcrumbs used a missing
joinRequestType to mean joined, which is also the case for rooms that
have been left or banned from. It only worked because the room list's
base filter already drops those.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Velin92 <34335419+Velin92@users.noreply.github.com>
Co-authored-by: Mauro Romito <mauro.romito@element.io>
This commit is contained in:
Copilot
2026-10-02 12:44:33 +00:00
committed by GitHub
parent 4fe58c2d0a
commit c41a38159b
28 changed files with 141 additions and 56 deletions
@@ -218,6 +218,7 @@ private extension HomeScreenRoom {
let summary = RoomSummary(room: RoomSDKMock(),
id: "@someone:somewhere.com",
joinRequestType: .invite(inviter: inviter),
isJoined: false,
name: "Some Guy",
isDirect: true,
isSpace: false,
@@ -254,6 +255,7 @@ private extension HomeScreenRoom {
let summary = RoomSummary(room: RoomSDKMock(),
id: "@someone:somewhere.com",
joinRequestType: .invite(inviter: inviter),
isJoined: false,
name: name,
isDirect: false,
isSpace: isSpace,
@@ -150,6 +150,7 @@ private extension HomeScreenRoom {
let summary = RoomSummary(room: RoomSDKMock(),
id: "@someone:somewhere.com",
joinRequestType: .invite(inviter: inviter),
isJoined: false,
name: "Some Guy",
isDirect: true,
isSpace: false,
@@ -183,6 +184,7 @@ private extension HomeScreenRoom {
let summary = RoomSummary(room: RoomSDKMock(),
id: "@someone:somewhere.com",
joinRequestType: .invite(inviter: inviter),
isJoined: false,
name: "Awesome Room",
isDirect: false,
isSpace: false,
@@ -268,6 +268,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
let summary = RoomSummary(room: RoomSDKMock(),
id: UUID().uuidString,
joinRequestType: nil,
isJoined: true,
name: name,
isDirect: heroes.count == 1,
isSpace: false,
@@ -88,7 +88,7 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
private func updateRooms() {
state.rooms = roomSummaryProvider.roomListPublisher.value
.filter { $0.id != forwardingPayload.roomID }
.filter { $0.id != forwardingPayload.roomID && !$0.isTombstoned }
.map(MessageForwardingRoom.init(summary:))
}
@@ -99,7 +99,7 @@ class MessageForwardingScreenViewModel: MessageForwardingScreenViewModelType, Me
state.suggestedRooms = roomIDs
.filter { $0 != forwardingPayload.roomID }
.compactMap(clientProxy.roomSummaryForIdentifier)
.filter { $0.joinRequestType == nil && !$0.isSpace && !$0.isTombstoned }
.filter { $0.isJoined && !$0.isSpace && !$0.isTombstoned }
.prefix(Self.maxSuggestedRoomCount)
.map(MessageForwardingRoom.init(summary:))
}
@@ -77,7 +77,7 @@ class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelect
private func updateRooms() {
var rooms = [RoomSelectionRoom]()
for summary in roomSummaryProvider.roomListPublisher.value {
for summary in roomSummaryProvider.roomListPublisher.value where !summary.isTombstoned {
rooms.append(.init(id: summary.id,
title: summary.name,
description: summary.roomListDescription,
@@ -194,7 +194,7 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro
switch mode {
case .rooms:
searchedQueries[mode] = searchQuery
roomSummaryProvider.setFilter(.search(query: searchQuery, joinedOnly: true))
roomSummaryProvider.setFilter(.search(query: searchQuery))
case .messages:
setQueryTask = Task { [weak self] in
// Debounce message queries; superseded keystrokes cancel this before it commits.
@@ -215,7 +215,7 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro
return .query(query)
case .room(let roomID):
// Drop rooms the user has since left or is only invited to, we've got nothing to show for them.
guard let summary = clientProxy.roomSummaryForIdentifier(roomID), summary.joinRequestType == nil else { return nil }
guard let summary = clientProxy.roomSummaryForIdentifier(roomID), summary.isJoined else { return nil }
return .room(SearchScreenRoom(summary))
}
}