@@ -479,12 +479,12 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
479479 // eslint-disable-next-line
480480 } , [ results , filter ] ) ;
481481
482- const viewRoom = ( roomId : string , persist = false , viaKeyboard = false ) => {
482+ const viewRoom = ( room : { roomId : string , roomAlias ?: string } , persist = false , viaKeyboard = false ) => {
483483 if ( persist ) {
484484 const recents = new Set ( SettingsStore . getValue ( "SpotlightSearch.recentSearches" , null ) . reverse ( ) ) ;
485485 // remove & add the room to put it at the end
486- recents . delete ( roomId ) ;
487- recents . add ( roomId ) ;
486+ recents . delete ( room . roomId ) ;
487+ recents . add ( room . roomId ) ;
488488
489489 SettingsStore . setValue (
490490 "SpotlightSearch.recentSearches" ,
@@ -496,9 +496,10 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
496496
497497 defaultDispatcher . dispatch < ViewRoomPayload > ( {
498498 action : Action . ViewRoom ,
499- room_id : roomId ,
500499 metricsTrigger : "WebUnifiedSearch" ,
501500 metricsViaKeyboard : viaKeyboard ,
501+ room_id : room . roomId ,
502+ room_alias : room . roomAlias ,
502503 } ) ;
503504 onFinished ( ) ;
504505 } ;
@@ -551,7 +552,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
551552 id = { `mx_SpotlightDialog_button_result_${ result . room . roomId } ` }
552553 key = { `${ Section [ result . section ] } -${ result . room . roomId } ` }
553554 onClick = { ( ev ) => {
554- viewRoom ( result . room . roomId , true , ev ?. type !== "click" ) ;
555+ viewRoom ( { roomId : result . room . roomId } , true , ev ?. type !== "click" ) ;
555556 } }
556557 { ...ariaProperties }
557558 >
@@ -598,7 +599,11 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
598599 if ( isPublicRoomResult ( result ) ) {
599600 const clientRoom = cli . getRoom ( result . publicRoom . room_id ) ;
600601 const listener = ( ev ) => {
601- viewRoom ( result . publicRoom . room_id , true , ev . type !== "click" ) ;
602+ const { publicRoom } = result ;
603+ viewRoom ( {
604+ roomAlias : publicRoom . canonical_alias || publicRoom . aliases ?. [ 0 ] ,
605+ roomId : publicRoom . room_id ,
606+ } , true , ev . type !== "click" ) ;
602607 } ;
603608 return (
604609 < Option
@@ -777,7 +782,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
777782 id = { `mx_SpotlightDialog_button_result_${ room . room_id } ` }
778783 key = { room . room_id }
779784 onClick = { ( ev ) => {
780- viewRoom ( room . room_id , true , ev ?. type !== "click" ) ;
785+ viewRoom ( { roomId : room . room_id } , true , ev ?. type !== "click" ) ;
781786 } }
782787 >
783788 < BaseAvatar
@@ -967,7 +972,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
967972 id = { `mx_SpotlightDialog_button_recentSearch_${ room . roomId } ` }
968973 key = { room . roomId }
969974 onClick = { ( ev ) => {
970- viewRoom ( room . roomId , true , ev ?. type !== "click" ) ;
975+ viewRoom ( { roomId : room . roomId } , true , ev ?. type !== "click" ) ;
971976 } }
972977 { ...ariaProperties }
973978 >
@@ -1008,7 +1013,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
10081013 title = { room . name }
10091014 key = { room . roomId }
10101015 onClick = { ( ev ) => {
1011- viewRoom ( room . roomId , false , ev . type !== "click" ) ;
1016+ viewRoom ( { roomId : room . roomId } , false , ev . type !== "click" ) ;
10121017 } }
10131018 >
10141019 < DecoratedRoomAvatar room = { room } avatarSize = { 32 } tooltipProps = { { tabIndex : - 1 } } />
0 commit comments