Add alt_aliases to room completion candidates
but don't match on name otherwise you see multiple entries per room when searching for a room name Also pass the roomId to the composer autocomplete, so it's easier to we don't need to loop through all the rooms and it's also easier accept room with local aliases as well in the future
This commit is contained in:
@@ -102,7 +102,7 @@ export default class AutocompleteWrapperModel {
|
||||
const text = completion.completion;
|
||||
switch (completion.type) {
|
||||
case "room":
|
||||
return [this._partCreator.roomPill(completionId), this._partCreator.plain(completion.suffix)];
|
||||
return [this._partCreator.roomPill(text, completionId), this._partCreator.plain(completion.suffix)];
|
||||
case "at-room":
|
||||
return [this._partCreator.atRoomPill(completionId), this._partCreator.plain(completion.suffix)];
|
||||
case "user":
|
||||
|
||||
+4
-4
@@ -422,14 +422,14 @@ export class PartCreator {
|
||||
return new PillCandidatePart(text, this._autoCompleteCreator);
|
||||
}
|
||||
|
||||
roomPill(alias) {
|
||||
roomPill(alias, roomId) {
|
||||
let room;
|
||||
if (alias[0] === '#') {
|
||||
if (roomId || alias[0] !== "#") {
|
||||
room = this._client.getRoom(roomId || alias);
|
||||
} else {
|
||||
room = this._client.getRooms().find((r) => {
|
||||
return r.getCanonicalAlias() === alias || r.getAliases().includes(alias);
|
||||
});
|
||||
} else {
|
||||
room = this._client.getRoom(alias);
|
||||
}
|
||||
return new RoomPillPart(alias, room);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user