Merge pull request #1069 from vector-im/dbkr/directory_room_metadata
Display room metadata from room previews when we come from the public room directory
This commit is contained in:
commit
adb6ab311c
1 changed files with 23 additions and 1 deletions
|
@ -66,9 +66,31 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
showRoom: function(roomId) {
|
showRoom: function(roomId) {
|
||||||
|
// extract the metadata from the publicRooms structure to pass
|
||||||
|
// as out-of-band data to view_room, because we get information
|
||||||
|
// here that we can't get other than by joining the room in some
|
||||||
|
// cases.
|
||||||
|
var room;
|
||||||
|
for (var i = 0; i < this.state.publicRooms.length; ++i) {
|
||||||
|
if (this.state.publicRooms[i].room_id == roomId) {
|
||||||
|
room = this.state.publicRooms[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var oob_data = {};
|
||||||
|
if (room) {
|
||||||
|
oob_data = {
|
||||||
|
avatarUrl: room.avatar_url,
|
||||||
|
// XXX: This logic is duplicated from the JS SDK which
|
||||||
|
// would normally decide what the name is.
|
||||||
|
name: room.name || room.aliases[0],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: roomId
|
room_id: roomId,
|
||||||
|
oob_data: oob_data,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue