mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 03:05:51 +03:00
Peek into world-readable rooms from spotlight (#9115)
This commit is contained in:
parent
f566c600e2
commit
fb25b3729d
2 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue