Merge pull request #3486 from element-hq/feature/bma/fixRoomAliasMatcch

Distinguish between roomId and roomAlias.
This commit is contained in:
Benoit Marty 2024-09-18 13:56:00 +02:00 committed by GitHub
commit e95388f3c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,7 +149,12 @@ object MatrixPatterns {
add(MatrixPatternResult(MatrixPatternType.USER_ID, permalink.userId.toString(), match.range.first, match.range.last + 1))
}
is PermalinkData.RoomLink -> {
add(MatrixPatternResult(MatrixPatternType.ROOM_ALIAS, permalink.roomIdOrAlias.identifier, match.range.first, match.range.last + 1))
when (permalink.roomIdOrAlias) {
is RoomIdOrAlias.Alias -> MatrixPatternType.ROOM_ALIAS
is RoomIdOrAlias.Id -> if (permalink.eventId == null) MatrixPatternType.ROOM_ID else null
}?.let { type ->
add(MatrixPatternResult(type, permalink.roomIdOrAlias.identifier, match.range.first, match.range.last + 1))
}
}
else -> Unit
}