@@ -25,9 +25,9 @@ import {MatrixClientPeg} from '../MatrixClientPeg';
2525import QueryMatcher from './QueryMatcher' ;
2626import { PillCompletion } from './Components' ;
2727import * as sdk from '../index' ;
28- import _sortBy from 'lodash/sortBy' ;
2928import { makeRoomPermalink } from "../utils/permalinks/Permalinks" ;
3029import { ICompletion , ISelectionRange } from "./Autocompleter" ;
30+ import { uniqBy , sortBy } from 'lodash' ;
3131
3232const ROOM_REGEX = / \B # \S * / g;
3333
@@ -91,10 +91,11 @@ export default class RoomProvider extends AutocompleteProvider {
9191 this . matcher . setObjects ( matcherObjects ) ;
9292 const matchedString = command [ 0 ] ;
9393 completions = this . matcher . match ( matchedString ) ;
94- completions = _sortBy ( completions , [
94+ completions = sortBy ( completions , [
9595 ( c ) => score ( matchedString , c . displayedAlias ) ,
9696 ( c ) => c . displayedAlias . length ,
9797 ] ) ;
98+ completions = uniqBy ( completions , ( match ) => match . room ) ;
9899 completions = completions . map ( ( room ) => {
99100 return {
100101 completion : room . displayedAlias ,
0 commit comments