Skip to content

Commit 2271ec7

Browse files
committed
Display room metadata from room previews when we come from the public room directory (more hacks to work around the fact that we can't get this data from the HS)
1 parent 332354e commit 2271ec7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/components/structures/RoomDirectory.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,27 @@ module.exports = React.createClass({
6666
},
6767

6868
showRoom: function(roomId) {
69+
var room;
70+
for (var i = 0; i < this.state.publicRooms.length; ++i) {
71+
if (this.state.publicRooms[i].room_id == roomId) {
72+
room = this.state.publicRooms[i];
73+
break;
74+
}
75+
}
76+
var oob_data = {};
77+
if (room) {
78+
oob_data = {
79+
avatarUrl: room.avatar_url,
80+
// XXX: This logic is duplicated from the JS SDK which
81+
// would normally decide what the name is.
82+
name: room.name || room.aliases[0],
83+
};
84+
}
85+
6986
dis.dispatch({
7087
action: 'view_room',
71-
room_id: roomId
88+
room_id: roomId,
89+
oob_data: oob_data,
7290
});
7391
},
7492

0 commit comments

Comments
 (0)