mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
Fix member list vanishing
Add a callback to RoomView that it can give the room ID to once it's resolved it, since this lookup is now the responsibility of the roomview and only the roomview. The view_room action now has either an alias or an ID, not both. Also fix RoomView to load the room properly and not try to peek when it shouldn't.
This commit is contained in:
parent
aaefdf19c5
commit
b8eee08d69
@ -392,10 +392,10 @@ module.exports = React.createClass({
|
||||
});
|
||||
break;
|
||||
case 'view_room':
|
||||
// Takes both room ID and room alias: if switching to a room the client is already
|
||||
// know to be in (eg. user clicks on a room in the recents panel), supply only the
|
||||
// ID. If the user is clicking on a room in the context of the alias being presented
|
||||
// to them, supply the room alias and optionally the room ID.
|
||||
// Takes either a room ID or room alias: if switching to a room the client is already
|
||||
// known to be in (eg. user clicks on a room in the recents panel), supply the ID
|
||||
// If the user is clicking on a room in the context of the alias being presented
|
||||
// to them, supply the room alias. If both are supplied, the room ID will be ignored.
|
||||
this._viewRoom(
|
||||
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
||||
payload.third_party_invite, payload.oob_data
|
||||
@ -507,9 +507,12 @@ module.exports = React.createClass({
|
||||
thirdPartyInvite: thirdPartyInvite,
|
||||
roomOobData: oob_data,
|
||||
currentRoomAlias: roomAlias,
|
||||
currentRoomId: roomId,
|
||||
};
|
||||
|
||||
if (!roomAlias) {
|
||||
newState.currentRoomId = roomId;
|
||||
}
|
||||
|
||||
// if we aren't given an explicit event id, look for one in the
|
||||
// scrollStateMap.
|
||||
if (!eventId) {
|
||||
@ -982,6 +985,13 @@ module.exports = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
onRoomIdResolved: function(room_id) {
|
||||
// It's the RoomView's resposibility to look up room aliases, but we need the
|
||||
// ID to pass into things like the Member List, so the Room View tells us when
|
||||
// its done that resolution so we can display things that take a room ID.
|
||||
this.setState({currentRoomId: room_id});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var LeftPanel = sdk.getComponent('structures.LeftPanel');
|
||||
var RoomView = sdk.getComponent('structures.RoomView');
|
||||
@ -1013,12 +1023,13 @@ module.exports = React.createClass({
|
||||
<RoomView
|
||||
ref="roomView"
|
||||
roomAddress={this.state.currentRoomAlias || this.state.currentRoomId}
|
||||
onRoomIdResolved={this.onRoomIdResolved}
|
||||
eventId={this.state.initialEventId}
|
||||
thirdPartyInvite={this.state.thirdPartyInvite}
|
||||
oobData={this.state.roomOobData}
|
||||
highlightedEventId={this.state.highlightedEventId}
|
||||
eventPixelOffset={this.state.initialEventPixelOffset}
|
||||
key={this.state.currentRoomId || this.state.currentRoomAlias}
|
||||
key={this.state.currentRoomAlias || this.state.currentRoomId}
|
||||
opacity={this.state.middleOpacity}
|
||||
ConferenceHandler={this.props.ConferenceHandler} />
|
||||
);
|
||||
|
@ -61,6 +61,11 @@ module.exports = React.createClass({
|
||||
// ID should be supplied.
|
||||
roomAddress: React.PropTypes.string.isRequired,
|
||||
|
||||
// If a room alias is passed to roomAddress, a function can be
|
||||
// provided here that will be called with the ID of the room
|
||||
// once it has been resolved.
|
||||
onRoomIdResolved: React.PropTypes.func,
|
||||
|
||||
// An object representing a third party invite to join this room
|
||||
// Fields:
|
||||
// * inviteSignUrl (string) The URL used to join this room from an email invite
|
||||
@ -151,9 +156,14 @@ module.exports = React.createClass({
|
||||
// right now. We may have joined that alias before but there's
|
||||
// no guarantee the alias hasn't subsequently been remapped.
|
||||
MatrixClientPeg.get().getRoomIdForAlias(this.props.roomAddress).done((result) => {
|
||||
if (this.props.onRoomIdResolved) {
|
||||
this.props.onRoomIdResolved(result.room_id);
|
||||
}
|
||||
var room = MatrixClientPeg.get().getRoom(result.room_id);
|
||||
this.setState({
|
||||
room: room,
|
||||
roomId: result.room_id,
|
||||
roomLoading: false,
|
||||
roomLoading: !room,
|
||||
}, this.updatePeeking);
|
||||
}, (err) => {
|
||||
this.setState({
|
||||
|
Loading…
Reference in New Issue
Block a user