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;
|
break;
|
||||||
case 'view_room':
|
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(
|
this._viewRoom(
|
||||||
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
payload.room_id, payload.room_alias, payload.show_settings, payload.event_id,
|
||||||
payload.third_party_invite, payload.oob_data
|
payload.third_party_invite, payload.oob_data
|
||||||
|
@ -423,12 +427,6 @@ module.exports = React.createClass({
|
||||||
this._viewRoom(allRooms[roomIndex].roomId);
|
this._viewRoom(allRooms[roomIndex].roomId);
|
||||||
}
|
}
|
||||||
break;
|
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':
|
case 'view_user_settings':
|
||||||
this._setPage(this.PageTypes.UserSettings);
|
this._setPage(this.PageTypes.UserSettings);
|
||||||
this.notifyNewScreen('settings');
|
this.notifyNewScreen('settings');
|
||||||
|
@ -502,8 +500,6 @@ module.exports = React.createClass({
|
||||||
this.focusComposer = true;
|
this.focusComposer = true;
|
||||||
|
|
||||||
var newState = {
|
var newState = {
|
||||||
currentRoom: roomId,
|
|
||||||
currentRoomAlias: roomAlias,
|
|
||||||
initialEventId: eventId,
|
initialEventId: eventId,
|
||||||
highlightedEventId: eventId,
|
highlightedEventId: eventId,
|
||||||
initialEventPixelOffset: undefined,
|
initialEventPixelOffset: undefined,
|
||||||
|
@ -512,6 +508,18 @@ module.exports = React.createClass({
|
||||||
roomOobData: oob_data,
|
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
|
// if we aren't given an explicit event id, look for one in the
|
||||||
// scrollStateMap.
|
// scrollStateMap.
|
||||||
if (!eventId) {
|
if (!eventId) {
|
||||||
|
@ -788,23 +796,16 @@ module.exports = React.createClass({
|
||||||
inviterName: params.inviter_name,
|
inviterName: params.inviter_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
var payload;
|
var payload = {
|
||||||
|
action: 'view_room',
|
||||||
|
event_id: eventId,
|
||||||
|
third_party_invite: third_party_invite,
|
||||||
|
oob_data: oob_data,
|
||||||
|
};
|
||||||
if (roomString[0] == '#') {
|
if (roomString[0] == '#') {
|
||||||
payload = {
|
payload.room_alias = roomString;
|
||||||
action: 'view_room_alias',
|
|
||||||
room_alias: roomString,
|
|
||||||
event_id: eventId,
|
|
||||||
third_party_invite: third_party_invite,
|
|
||||||
oob_data: oob_data,
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
payload = {
|
payload.room_id = roomString;
|
||||||
action: 'view_room',
|
|
||||||
room_id: roomString,
|
|
||||||
event_id: eventId,
|
|
||||||
third_party_invite: third_party_invite,
|
|
||||||
oob_data: oob_data,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can't view a room unless we're logged in
|
// we can't view a room unless we're logged in
|
||||||
|
@ -832,7 +833,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
onAliasClick: function(event, alias) {
|
onAliasClick: function(event, alias) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dis.dispatch({action: 'view_room_alias', room_alias: alias});
|
dis.dispatch({action: 'view_room', room_alias: alias});
|
||||||
},
|
},
|
||||||
|
|
||||||
onUserClick: function(event, userId) {
|
onUserClick: function(event, userId) {
|
||||||
|
|
Loading…
Reference in New Issue