Merge pull request #4102 from matrix-org/bwindels/aliasautocomplete
Use alt_aliases for pills and autocomplete
This commit is contained in:
commit
dc85346e5c
5 changed files with 37 additions and 30 deletions
|
@ -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":
|
||||
|
|
|
@ -422,14 +422,15 @@ export class PartCreator {
|
|||
return new PillCandidatePart(text, this._autoCompleteCreator);
|
||||
}
|
||||
|
||||
roomPill(alias) {
|
||||
roomPill(alias, roomId) {
|
||||
let room;
|
||||
if (alias[0] === '#') {
|
||||
room = this._client.getRooms().find((r) => {
|
||||
return r.getCanonicalAlias() === alias || r.getAliases().includes(alias);
|
||||
});
|
||||
if (roomId || alias[0] !== "#") {
|
||||
room = this._client.getRoom(roomId || alias);
|
||||
} else {
|
||||
room = this._client.getRoom(alias);
|
||||
room = this._client.getRooms().find((r) => {
|
||||
return r.getCanonicalAlias() === alias ||
|
||||
r.getAltAliases().includes(alias);
|
||||
});
|
||||
}
|
||||
return new RoomPillPart(alias, room);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue