Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6009d1c

Browse files
authored
Remove deprecated m.room.aliases references (#9431)
* Remove deprecated `m.room.aliases` references * Update SlashCommands.tsx
1 parent 2d9f828 commit 6009d1c

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

src/SlashCommands.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ export const Commands = [
711711
runFn: function(roomId, args) {
712712
const cli = MatrixClientPeg.get();
713713

714-
let targetRoomId;
714+
let targetRoomId: string;
715715
if (args) {
716716
const matches = args.match(/^(\S+)$/);
717717
if (matches) {
@@ -725,16 +725,11 @@ export const Commands = [
725725
// Try to find a room with this alias
726726
const rooms = cli.getRooms();
727727
for (let i = 0; i < rooms.length; i++) {
728-
const aliasEvents = rooms[i].currentState.getStateEvents('m.room.aliases');
729-
for (let j = 0; j < aliasEvents.length; j++) {
730-
const aliases = aliasEvents[j].getContent().aliases || [];
731-
for (let k = 0; k < aliases.length; k++) {
732-
if (aliases[k] === roomAlias) {
733-
targetRoomId = rooms[i].roomId;
734-
break;
735-
}
736-
}
737-
if (targetRoomId) break;
728+
if (rooms[i].getCanonicalAlias() === roomAlias ||
729+
rooms[i].getAltAliases().includes(roomAlias)
730+
) {
731+
targetRoomId = rooms[i].roomId;
732+
break;
738733
}
739734
if (targetRoomId) break;
740735
}

src/Unread.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export function eventTriggersUnreadCount(ev: MatrixEvent): boolean {
4242
case EventType.RoomThirdPartyInvite:
4343
case EventType.CallAnswer:
4444
case EventType.CallHangup:
45-
case EventType.RoomAliases:
4645
case EventType.RoomCanonicalAlias:
4746
case EventType.RoomServerAcl:
4847
case M_BEACON.name:

test/Unread-test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ describe('eventTriggersUnreadCount()', () => {
103103
EventType.RoomThirdPartyInvite,
104104
EventType.CallAnswer,
105105
EventType.CallHangup,
106-
EventType.RoomAliases,
107106
EventType.RoomCanonicalAlias,
108107
EventType.RoomServerAcl,
109108
];

0 commit comments

Comments
 (0)