Fix wrong buttons being used when exploring public rooms (#9062)
This commit is contained in:
parent
be0f4a1fe5
commit
dca4b8b291
2 changed files with 45 additions and 2 deletions
|
@ -607,6 +607,16 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
}
|
||||
if (isPublicRoomResult(result)) {
|
||||
const clientRoom = cli.getRoom(result.publicRoom.room_id);
|
||||
// Element Web currently does not allow guests to join rooms, so we
|
||||
// instead show them view buttons for all rooms. If the room is not
|
||||
// world readable, a modal will appear asking you to register first. If
|
||||
// it is readable, the preview appears as normal.
|
||||
const showViewButton = (
|
||||
clientRoom?.getMyMembership() === "join" ||
|
||||
result.publicRoom.world_readable ||
|
||||
cli.isGuest()
|
||||
);
|
||||
|
||||
const listener = (ev) => {
|
||||
const { publicRoom } = result;
|
||||
viewRoom({
|
||||
|
@ -622,11 +632,11 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
onClick={listener}
|
||||
endAdornment={
|
||||
<AccessibleButton
|
||||
kind={clientRoom ? "primary" : "primary_outline"}
|
||||
kind={showViewButton ? "primary_outline" : "primary"}
|
||||
onClick={listener}
|
||||
tabIndex={-1}
|
||||
>
|
||||
{ _t(clientRoom ? "View" : "Join") }
|
||||
{ showViewButton ? _t("View") : _t("Join") }
|
||||
</AccessibleButton>}
|
||||
aria-labelledby={`mx_SpotlightDialog_button_result_${result.publicRoom.room_id}_name`}
|
||||
aria-describedby={`mx_SpotlightDialog_button_result_${result.publicRoom.room_id}_alias`}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue