Remove deprecated m.room.aliases references (#2759)

This commit is contained in:
Michael Telatynski
2022-10-17 10:58:48 +01:00
committed by GitHub
parent be11fa6b5a
commit 041f9951c5
3 changed files with 0 additions and 34 deletions
-4
View File
@@ -33,10 +33,6 @@ export enum EventType {
RoomGuestAccess = "m.room.guest_access",
RoomServerAcl = "m.room.server_acl",
RoomTombstone = "m.room.tombstone",
/**
* @deprecated Should not be used.
*/
RoomAliases = "m.room.aliases", // deprecated https://matrix.org/docs/spec/client_server/r0.6.1#historical-events
SpaceChild = "m.space.child",
SpaceParent = "m.space.parent",
-1
View File
@@ -1585,7 +1585,6 @@ const REDACT_KEEP_CONTENT_MAP = {
'kick': 1, 'redact': 1, 'state_default': 1,
'users': 1, 'users_default': 1,
},
[EventType.RoomAliases]: { 'aliases': 1 },
};
/**
-29
View File
@@ -1369,35 +1369,6 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
return this.currentState.getStateEvents(EventType.RoomAvatar, "")?.getContent()?.url || null;
}
/**
* Get the aliases this room has according to the room's state
* The aliases returned by this function may not necessarily
* still point to this room.
* @return {array} The room's alias as an array of strings
* @deprecated this uses m.room.aliases events, replaced by Room::getAltAliases()
*/
public getAliases(): string[] {
const aliasStrings: string[] = [];
const aliasEvents = this.currentState.getStateEvents(EventType.RoomAliases);
if (aliasEvents) {
for (const aliasEvent of aliasEvents) {
if (Array.isArray(aliasEvent.getContent().aliases)) {
const filteredAliases = aliasEvent.getContent<{ aliases: string[] }>().aliases.filter(a => {
if (typeof(a) !== "string") return false;
if (a[0] !== '#') return false;
if (!a.endsWith(`:${aliasEvent.getStateKey()}`)) return false;
// It's probably valid by here.
return true;
});
aliasStrings.push(...filteredAliases);
}
}
}
return aliasStrings;
}
/**
* Get this room's canonical alias
* The alias returned by this function may not necessarily