mirror of https://github.com/vector-im/riot-web
Remove view_room_alias
As it was basically the same as view_room. Use view_room instead which will handle whether we pass an ID or an alias into RoomViewpull/21833/head
parent
b60ab9d695
commit
719928f389
|
@ -392,6 +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.
|
||||
this._viewRoom(
|
||||
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
||||
payload.third_party_invite, payload.oob_data
|
||||
|
@ -423,12 +427,6 @@ module.exports = React.createClass({
|
|||
this._viewRoom(allRooms[roomIndex].roomId);
|
||||
}
|
||||
break;
|
||||
case 'view_room_alias':
|
||||
this._viewRoom(
|
||||
undefined, payload.room_alias, undefined, payload.event_id,
|
||||
payload.third_party_invite, payload.oob_data
|
||||
);
|
||||
break;
|
||||
case 'view_user_settings':
|
||||
this._setPage(this.PageTypes.UserSettings);
|
||||
this.notifyNewScreen('settings');
|
||||
|
@ -502,8 +500,6 @@ module.exports = React.createClass({
|
|||
this.focusComposer = true;
|
||||
|
||||
var newState = {
|
||||
currentRoom: roomId,
|
||||
currentRoomAlias: roomAlias,
|
||||
initialEventId: eventId,
|
||||
highlightedEventId: eventId,
|
||||
initialEventPixelOffset: undefined,
|
||||
|
@ -512,6 +508,18 @@ module.exports = React.createClass({
|
|||
roomOobData: oob_data,
|
||||
};
|
||||
|
||||
// If an alias has been provided, we use that and only that,
|
||||
// since otherwise we'll prefer to pass in an ID to RoomView
|
||||
// but if we're not in the room, we should join by alias rather
|
||||
// than ID.
|
||||
if (roomAlias) {
|
||||
newState.currentRoomAlias = roomAlias;
|
||||
newState.currentRoom = null;
|
||||
} else {
|
||||
newState.currentRoomAlias = null;
|
||||
newState.currentRoom = roomId;
|
||||
}
|
||||
|
||||
// if we aren't given an explicit event id, look for one in the
|
||||
// scrollStateMap.
|
||||
if (!eventId) {
|
||||
|
@ -788,23 +796,16 @@ module.exports = React.createClass({
|
|||
inviterName: params.inviter_name,
|
||||
};
|
||||
|
||||
var payload;
|
||||
if (roomString[0] == '#') {
|
||||
payload = {
|
||||
action: 'view_room_alias',
|
||||
room_alias: roomString,
|
||||
event_id: eventId,
|
||||
third_party_invite: third_party_invite,
|
||||
oob_data: oob_data,
|
||||
};
|
||||
} else {
|
||||
payload = {
|
||||
var payload = {
|
||||
action: 'view_room',
|
||||
room_id: roomString,
|
||||
event_id: eventId,
|
||||
third_party_invite: third_party_invite,
|
||||
oob_data: oob_data,
|
||||
};
|
||||
if (roomString[0] == '#') {
|
||||
payload.room_alias = roomString;
|
||||
} else {
|
||||
payload.room_id = roomString;
|
||||
}
|
||||
|
||||
// we can't view a room unless we're logged in
|
||||
|
@ -832,7 +833,7 @@ module.exports = React.createClass({
|
|||
|
||||
onAliasClick: function(event, alias) {
|
||||
event.preventDefault();
|
||||
dis.dispatch({action: 'view_room_alias', room_alias: alias});
|
||||
dis.dispatch({action: 'view_room', room_alias: alias});
|
||||
},
|
||||
|
||||
onUserClick: function(event, userId) {
|
||||
|
|
Loading…
Reference in New Issue