From 041f9951c5613fa0bfafb50e76b2fed6e8181fda Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 Oct 2022 10:58:48 +0100 Subject: [PATCH] Remove deprecated `m.room.aliases` references (#2759) --- src/@types/event.ts | 4 ---- src/models/event.ts | 1 - src/models/room.ts | 29 ----------------------------- 3 files changed, 34 deletions(-) diff --git a/src/@types/event.ts b/src/@types/event.ts index 045f9af5170..6ecde1a122c 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -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", diff --git a/src/models/event.ts b/src/models/event.ts index 32fd4d7441a..50de12973ac 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -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 }, }; /** diff --git a/src/models/room.ts b/src/models/room.ts index de285dca78f..e4a1566c321 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -1369,35 +1369,6 @@ export class Room extends ReadReceipt { 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