mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Fix force completion and hide rooms with no alias
This commit is contained in:
parent
9a991a4dfd
commit
79e5e6f6fe
@ -44,7 +44,7 @@ export default class RoomProvider extends AutocompleteProvider {
|
||||
),
|
||||
range,
|
||||
};
|
||||
}).slice(0, 4);
|
||||
}).filter(completion => !!completion.completion && completion.completion.length > 0).slice(0, 4);
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import flatMap from 'lodash/flatMap';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import sdk from '../../../index';
|
||||
import type {Completion, SelectionRange} from '../../../autocomplete/Autocompleter';
|
||||
import Q from 'q';
|
||||
|
||||
import {getCompletions} from '../../../autocomplete/Autocompleter';
|
||||
|
||||
@ -140,12 +141,15 @@ export default class Autocomplete extends React.Component {
|
||||
}
|
||||
|
||||
forceComplete() {
|
||||
const done = Q.defer();
|
||||
this.setState({
|
||||
forceComplete: true,
|
||||
}, () => {
|
||||
this.complete(this.props.query, this.props.selection);
|
||||
setTimeout(() => this.onDownArrow(), 50); // FIXME HACK
|
||||
this.complete(this.props.query, this.props.selection).then(() => {
|
||||
done.resolve();
|
||||
});
|
||||
});
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
/** called from MessageComposerInput
|
||||
|
@ -595,7 +595,9 @@ export default class MessageComposerInput extends React.Component {
|
||||
e.preventDefault(); // we *never* want tab's default to happen, but we do want up/down sometimes
|
||||
const didTab = await (e.shiftKey ? this.onUpArrow : this.onDownArrow)(e);
|
||||
if (!didTab && this.autocomplete) {
|
||||
this.autocomplete.forceComplete();
|
||||
this.autocomplete.forceComplete().then(() => {
|
||||
this.onDownArrow(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user