hopefully fix https://github.com/vector-im/vector-web/issues/819
This commit is contained in:
parent
79eb54058f
commit
5e050c6276
2 changed files with 13 additions and 4 deletions
|
@ -325,7 +325,7 @@ module.exports = React.createClass({
|
||||||
break;
|
break;
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
this._viewRoom(
|
this._viewRoom(
|
||||||
payload.room_id, payload.show_settings, payload.event_id,
|
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
||||||
payload.invite_sign_url, payload.oob_data
|
payload.invite_sign_url, payload.oob_data
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -371,6 +371,7 @@ module.exports = React.createClass({
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: foundRoom.roomId,
|
room_id: foundRoom.roomId,
|
||||||
|
room_alias: payload.room_alias,
|
||||||
event_id: payload.event_id,
|
event_id: payload.event_id,
|
||||||
invite_sign_url: payload.invite_sign_url,
|
invite_sign_url: payload.invite_sign_url,
|
||||||
oob_data: payload.oob_data,
|
oob_data: payload.oob_data,
|
||||||
|
@ -383,6 +384,7 @@ module.exports = React.createClass({
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: result.room_id,
|
room_id: result.room_id,
|
||||||
|
room_alias: payload.room_alias,
|
||||||
event_id: payload.event_id,
|
event_id: payload.event_id,
|
||||||
invite_sign_url: payload.invite_sign_url,
|
invite_sign_url: payload.invite_sign_url,
|
||||||
oob_data: payload.oob_data,
|
oob_data: payload.oob_data,
|
||||||
|
@ -476,7 +478,7 @@ module.exports = React.createClass({
|
||||||
// @param {Object} oob_data Object of additional data about the room
|
// @param {Object} oob_data Object of additional data about the room
|
||||||
// that has been passed out-of-band (eg.
|
// that has been passed out-of-band (eg.
|
||||||
// room name and avatar from an invite email)
|
// room name and avatar from an invite email)
|
||||||
_viewRoom: function(roomId, showSettings, eventId, invite_sign_url, oob_data) {
|
_viewRoom: function(roomId, roomAlias, showSettings, eventId, invite_sign_url, oob_data) {
|
||||||
// before we switch room, record the scroll state of the current room
|
// before we switch room, record the scroll state of the current room
|
||||||
this._updateScrollMap();
|
this._updateScrollMap();
|
||||||
|
|
||||||
|
@ -484,6 +486,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
var newState = {
|
var newState = {
|
||||||
currentRoom: roomId,
|
currentRoom: roomId,
|
||||||
|
currentRoomAlias: roomAlias,
|
||||||
initialEventId: eventId,
|
initialEventId: eventId,
|
||||||
highlightedEventId: eventId,
|
highlightedEventId: eventId,
|
||||||
initialEventPixelOffset: undefined,
|
initialEventPixelOffset: undefined,
|
||||||
|
@ -508,7 +511,7 @@ module.exports = React.createClass({
|
||||||
// the new screen yet (we won't be showing it yet)
|
// the new screen yet (we won't be showing it yet)
|
||||||
// The normal case where this happens is navigating
|
// The normal case where this happens is navigating
|
||||||
// to the room in the URL bar on page load.
|
// to the room in the URL bar on page load.
|
||||||
var presentedId = roomId;
|
var presentedId = roomAlias || roomId;
|
||||||
var room = MatrixClientPeg.get().getRoom(roomId);
|
var room = MatrixClientPeg.get().getRoom(roomId);
|
||||||
if (room) {
|
if (room) {
|
||||||
var theAlias = MatrixTools.getCanonicalAliasForRoom(room);
|
var theAlias = MatrixTools.getCanonicalAliasForRoom(room);
|
||||||
|
@ -912,6 +915,7 @@ module.exports = React.createClass({
|
||||||
<RoomView
|
<RoomView
|
||||||
ref="roomView"
|
ref="roomView"
|
||||||
roomId={this.state.currentRoom}
|
roomId={this.state.currentRoom}
|
||||||
|
roomAlias={this.state.currentRoomAlias}
|
||||||
eventId={this.state.initialEventId}
|
eventId={this.state.initialEventId}
|
||||||
inviteSignUrl={this.state.inviteSignUrl}
|
inviteSignUrl={this.state.inviteSignUrl}
|
||||||
oobData={this.state.roomOobData}
|
oobData={this.state.roomOobData}
|
||||||
|
|
|
@ -56,6 +56,10 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
roomId: React.PropTypes.string.isRequired,
|
roomId: React.PropTypes.string.isRequired,
|
||||||
|
|
||||||
|
// if we are referring to this room by a given alias (e.g. in the URL), track it.
|
||||||
|
// useful for joining rooms by alias correctly (and fixing https://github.com/vector-im/vector-web/issues/819)
|
||||||
|
roomAlias: React.PropTypes.string,
|
||||||
|
|
||||||
// The URL used to join this room from an email invite
|
// The URL used to join this room from an email invite
|
||||||
// (given as part of the link in the invite email)
|
// (given as part of the link in the invite email)
|
||||||
inviteSignUrl: React.PropTypes.string,
|
inviteSignUrl: React.PropTypes.string,
|
||||||
|
@ -529,7 +533,8 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
display_name_promise.then(() => {
|
display_name_promise.then(() => {
|
||||||
return MatrixClientPeg.get().joinRoom(this.props.roomId, { inviteSignUrl: this.props.inviteSignUrl } )
|
return MatrixClientPeg.get().joinRoom(this.props.roomAlias || this.props.roomId,
|
||||||
|
{ inviteSignUrl: this.props.inviteSignUrl } )
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
// It is possible that there is no Room yet if state hasn't come down
|
// It is possible that there is no Room yet if state hasn't come down
|
||||||
// from /sync - joinRoom will resolve when the HTTP request to join succeeds,
|
// from /sync - joinRoom will resolve when the HTTP request to join succeeds,
|
||||||
|
|
Loading…
Reference in a new issue