Peek into world-readable rooms from spotlight (#9115)

t3chguy/dedup-icons-17oct
Šimon Brandner 2022-07-29 16:25:28 +02:00 committed by GitHub
parent f566c600e2
commit fb25b3729d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -246,7 +246,7 @@ describe("Spotlight", () => {
cy.spotlightResults().eq(0).click();
cy.url().should("contain", room2Id);
}).then(() => {
cy.get(".mx_RoomPreviewBar_actions .mx_AccessibleButton").click();
cy.get(".mx_RoomView_MessageList").should("have.length", 1);
cy.roomHeaderName().should("contain", room2Name);
});
});

View File

@ -485,7 +485,11 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
// eslint-disable-next-line
}, [results, filter]);
const viewRoom = (room: {roomId: string, roomAlias?: string}, persist = false, viaKeyboard = false) => {
const viewRoom = (
room: { roomId: string, roomAlias?: string, autoJoin?: boolean, shouldPeek?: boolean},
persist = false,
viaKeyboard = false,
) => {
if (persist) {
const recents = new Set(SettingsStore.getValue("SpotlightSearch.recentSearches", null).reverse());
// remove & add the room to put it at the end
@ -506,6 +510,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
metricsViaKeyboard: viaKeyboard,
room_id: room.roomId,
room_alias: room.roomAlias,
auto_join: room.autoJoin,
should_peek: room.shouldPeek,
});
onFinished();
};
@ -623,6 +629,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
viewRoom({
roomAlias: publicRoom.canonical_alias || publicRoom.aliases?.[0],
roomId: publicRoom.room_id,
autoJoin: !result.publicRoom.world_readable && !cli.isGuest(),
shouldPeek: result.publicRoom.world_readable || cli.isGuest(),
}, true, ev.type !== "click");
};
return (