You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-18 09:22:18 +03:00
Style changes and improvements in autocomplete
This commit is contained in:
@ -4,20 +4,22 @@ import MatrixClientPeg from '../MatrixClientPeg';
|
||||
|
||||
const ROOM_REGEX = /@[^\s]*/g;
|
||||
|
||||
let instance = null;
|
||||
|
||||
export default class UserProvider extends AutocompleteProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.users = [];
|
||||
}
|
||||
|
||||
getCompletions(query: String) {
|
||||
let client = MatrixClientPeg.get();
|
||||
let completions = [];
|
||||
const matches = query.match(ROOM_REGEX);
|
||||
if(!!matches) {
|
||||
const command = matches[0];
|
||||
completions = client.getUsers().map(user => {
|
||||
completions = this.users.map(user => {
|
||||
return {
|
||||
title: user.displayName,
|
||||
title: user.displayName || user.userId,
|
||||
description: user.userId
|
||||
};
|
||||
});
|
||||
@ -28,4 +30,15 @@ export default class UserProvider extends AutocompleteProvider {
|
||||
getName() {
|
||||
return 'Users';
|
||||
}
|
||||
|
||||
setUserList(users) {
|
||||
console.log('setUserList');
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
static getInstance(): UserProvider {
|
||||
if(instance == null)
|
||||
instance = new UserProvider();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user