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

* Remove deprecated `m.room.aliases` references

* Update SlashCommands.tsx
This commit is contained in:
Michael Telatynski 2022-10-17 10:58:46 +01:00 committed by GitHub
parent 2d9f828810
commit 6009d1c176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 13 deletions

View file

@ -711,7 +711,7 @@ export const Commands = [
runFn: function(roomId, args) { runFn: function(roomId, args) {
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
let targetRoomId; let targetRoomId: string;
if (args) { if (args) {
const matches = args.match(/^(\S+)$/); const matches = args.match(/^(\S+)$/);
if (matches) { if (matches) {
@ -725,17 +725,12 @@ export const Commands = [
// Try to find a room with this alias // Try to find a room with this alias
const rooms = cli.getRooms(); const rooms = cli.getRooms();
for (let i = 0; i < rooms.length; i++) { for (let i = 0; i < rooms.length; i++) {
const aliasEvents = rooms[i].currentState.getStateEvents('m.room.aliases'); if (rooms[i].getCanonicalAlias() === roomAlias ||
for (let j = 0; j < aliasEvents.length; j++) { rooms[i].getAltAliases().includes(roomAlias)
const aliases = aliasEvents[j].getContent().aliases || []; ) {
for (let k = 0; k < aliases.length; k++) {
if (aliases[k] === roomAlias) {
targetRoomId = rooms[i].roomId; targetRoomId = rooms[i].roomId;
break; break;
} }
}
if (targetRoomId) break;
}
if (targetRoomId) break; if (targetRoomId) break;
} }
if (!targetRoomId) { if (!targetRoomId) {

View file

@ -42,7 +42,6 @@ export function eventTriggersUnreadCount(ev: MatrixEvent): boolean {
case EventType.RoomThirdPartyInvite: case EventType.RoomThirdPartyInvite:
case EventType.CallAnswer: case EventType.CallAnswer:
case EventType.CallHangup: case EventType.CallHangup:
case EventType.RoomAliases:
case EventType.RoomCanonicalAlias: case EventType.RoomCanonicalAlias:
case EventType.RoomServerAcl: case EventType.RoomServerAcl:
case M_BEACON.name: case M_BEACON.name:

View file

@ -103,7 +103,6 @@ describe('eventTriggersUnreadCount()', () => {
EventType.RoomThirdPartyInvite, EventType.RoomThirdPartyInvite,
EventType.CallAnswer, EventType.CallAnswer,
EventType.CallHangup, EventType.CallHangup,
EventType.RoomAliases,
EventType.RoomCanonicalAlias, EventType.RoomCanonicalAlias,
EventType.RoomServerAcl, EventType.RoomServerAcl,
]; ];