@@ -81,16 +81,18 @@ module.exports = React.createClass({
8181 // });
8282 } ,
8383
84- showRoom : function ( roomId ) {
84+ showRoom : function ( roomId , roomAlias ) {
8585 // extract the metadata from the publicRooms structure to pass
8686 // as out-of-band data to view_room, because we get information
8787 // here that we can't get other than by joining the room in some
8888 // cases.
8989 var room ;
90- for ( var i = 0 ; i < this . state . publicRooms . length ; ++ i ) {
91- if ( this . state . publicRooms [ i ] . room_id == roomId ) {
92- room = this . state . publicRooms [ i ] ;
93- break ;
90+ if ( roomId ) {
91+ for ( var i = 0 ; i < this . state . publicRooms . length ; ++ i ) {
92+ if ( this . state . publicRooms [ i ] . room_id == roomId ) {
93+ room = this . state . publicRooms [ i ] ;
94+ break ;
95+ }
9496 }
9597 }
9698 var oob_data = { } ;
@@ -114,10 +116,15 @@ module.exports = React.createClass({
114116 } ;
115117 }
116118
119+ // It's not really possible to join Matrix rooms by ID because the HS has no way to know
120+ // which servers to start querying. However, there's no other way to join rooms in
121+ // this list without aliases at present, so if roomAlias isn't set here we'll rely
122+ // on view_room falling back to using the ID
117123 dis . dispatch ( {
124+ oob_data : oob_data ,
118125 action : 'view_room' ,
119126 room_id : roomId ,
120- oob_data : oob_data ,
127+ room_alias : roomAlias ,
121128 } ) ;
122129 } ,
123130
@@ -164,7 +171,7 @@ module.exports = React.createClass({
164171 topic = linkifyString ( sanitizeHtml ( topic ) ) ;
165172
166173 rows . unshift (
167- < tr key = { rooms [ i ] . room_id } onClick = { self . showRoom . bind ( null , rooms [ i ] . room_id ) } >
174+ < tr key = { rooms [ i ] . room_id } onClick = { self . showRoom . bind ( null , rooms [ i ] . room_id , alias ) } >
168175 < td className = "mx_RoomDirectory_roomAvatar" >
169176 < BaseAvatar width = { 24 } height = { 24 } resizeMethod = 'crop'
170177 name = { name } idName = { name }
@@ -193,7 +200,7 @@ module.exports = React.createClass({
193200 this . forceUpdate ( ) ;
194201 this . setState ( { roomAlias : this . refs . roomAlias . value } )
195202 if ( ev . key == "Enter" ) {
196- this . showRoom ( this . refs . roomAlias . value ) ;
203+ this . showRoom ( null , this . refs . roomAlias . value ) ;
197204 }
198205 } ,
199206
0 commit comments