mirror of https://github.com/vector-im/riot-web
Peek into world-readable rooms from spotlight (#9115)
parent
f566c600e2
commit
fb25b3729d
|
@ -246,7 +246,7 @@ describe("Spotlight", () => {
|
||||||
cy.spotlightResults().eq(0).click();
|
cy.spotlightResults().eq(0).click();
|
||||||
cy.url().should("contain", room2Id);
|
cy.url().should("contain", room2Id);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
cy.get(".mx_RoomPreviewBar_actions .mx_AccessibleButton").click();
|
cy.get(".mx_RoomView_MessageList").should("have.length", 1);
|
||||||
cy.roomHeaderName().should("contain", room2Name);
|
cy.roomHeaderName().should("contain", room2Name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -485,7 +485,11 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [results, filter]);
|
}, [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) {
|
if (persist) {
|
||||||
const recents = new Set(SettingsStore.getValue("SpotlightSearch.recentSearches", null).reverse());
|
const recents = new Set(SettingsStore.getValue("SpotlightSearch.recentSearches", null).reverse());
|
||||||
// remove & add the room to put it at the end
|
// remove & add the room to put it at the end
|
||||||
|
@ -506,6 +510,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||||
metricsViaKeyboard: viaKeyboard,
|
metricsViaKeyboard: viaKeyboard,
|
||||||
room_id: room.roomId,
|
room_id: room.roomId,
|
||||||
room_alias: room.roomAlias,
|
room_alias: room.roomAlias,
|
||||||
|
auto_join: room.autoJoin,
|
||||||
|
should_peek: room.shouldPeek,
|
||||||
});
|
});
|
||||||
onFinished();
|
onFinished();
|
||||||
};
|
};
|
||||||
|
@ -623,6 +629,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||||
viewRoom({
|
viewRoom({
|
||||||
roomAlias: publicRoom.canonical_alias || publicRoom.aliases?.[0],
|
roomAlias: publicRoom.canonical_alias || publicRoom.aliases?.[0],
|
||||||
roomId: publicRoom.room_id,
|
roomId: publicRoom.room_id,
|
||||||
|
autoJoin: !result.publicRoom.world_readable && !cli.isGuest(),
|
||||||
|
shouldPeek: result.publicRoom.world_readable || cli.isGuest(),
|
||||||
}, true, ev.type !== "click");
|
}, true, ev.type !== "click");
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue