mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 06:50:52 +00:00
SYWEB-146: Fix room ID leaking on recents page when the name of the room is just an alias.
This commit is contained in:
parent
9d0efedaee
commit
2c400363e8
2 changed files with 8 additions and 3 deletions
|
@ -39,7 +39,6 @@ angular.module('matrixService', [])
|
||||||
// Current version of permanent storage
|
// Current version of permanent storage
|
||||||
var configVersion = 0;
|
var configVersion = 0;
|
||||||
var prefixPath = "/_matrix/client/api/v1";
|
var prefixPath = "/_matrix/client/api/v1";
|
||||||
var MAPPING_PREFIX = "alias_for_";
|
|
||||||
|
|
||||||
var doRequest = function(method, path, params, data, $httpParams) {
|
var doRequest = function(method, path, params, data, $httpParams) {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
|
|
|
@ -31,6 +31,10 @@ angular.module('modelService', [])
|
||||||
// alias / id lookups
|
// alias / id lookups
|
||||||
var roomIdToAlias = {};
|
var roomIdToAlias = {};
|
||||||
var aliasToRoomId = {};
|
var aliasToRoomId = {};
|
||||||
|
var setRoomIdToAliasMapping = function(roomId, alias) {
|
||||||
|
roomIdToAlias[roomId] = alias;
|
||||||
|
aliasToRoomId[alias] = roomId;
|
||||||
|
};
|
||||||
|
|
||||||
/***** Room Object *****/
|
/***** Room Object *****/
|
||||||
var Room = function Room(room_id) {
|
var Room = function Room(room_id) {
|
||||||
|
@ -114,6 +118,9 @@ angular.module('modelService', [])
|
||||||
rm.event = event;
|
rm.event = event;
|
||||||
this.members[event.state_key] = rm;
|
this.members[event.state_key] = rm;
|
||||||
}
|
}
|
||||||
|
else if (event.type === "m.room.aliases") {
|
||||||
|
setRoomIdToAliasMapping(event.room_id, event.content.aliases[0]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
storeStateEvents: function storeState(events) {
|
storeStateEvents: function storeState(events) {
|
||||||
|
@ -210,8 +217,7 @@ angular.module('modelService', [])
|
||||||
},
|
},
|
||||||
|
|
||||||
createRoomIdToAliasMapping: function(roomId, alias) {
|
createRoomIdToAliasMapping: function(roomId, alias) {
|
||||||
roomIdToAlias[roomId] = alias;
|
setRoomIdToAliasMapping(roomId, alias);
|
||||||
aliasToRoomId[alias] = roomId;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getRoomIdToAliasMapping: function(roomId) {
|
getRoomIdToAliasMapping: function(roomId) {
|
||||||
|
|
Loading…
Reference in a new issue