FIX: emoji_autocomplete_min_chars failing when not 0

autocomplete resolving to [] was causing it to stop working.
Instead we have a special const (SKIP) which ensures it will
continue to be evaluated and only this instance is skipped.
This commit is contained in:
Sam Saffron 2020-06-30 17:39:52 +10:00 committed by Robin Ward
parent 67cc6731c6
commit 43a41f3928
2 changed files with 3 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import { emojiUrlFor } from "discourse/lib/text";
import showModal from "discourse/lib/show-modal";
import { Promise } from "rsvp";
import { isTesting } from "discourse-common/config/environment";
import { SKIP } from "discourse/lib/autocomplete";
// Our head can be a static string or a function that returns a string
// based on input (like for numbered lists).
@ -480,7 +481,7 @@ export default Component.extend({
term = term.toLowerCase();
if (term.length < this.siteSettings.emoji_autocomplete_min_chars) {
return resolve([]);
return resolve(SKIP);
}
if (term === "") {

View File

@ -9,6 +9,7 @@ import Site from "discourse/models/site";
@module $.fn.autocomplete
**/
export const SKIP = "skip";
export const CANCELLED_STATUS = "__CANCELLED";
const allowedLettersRegex = /[\s\t\[\{\(\/]/;
@ -352,8 +353,6 @@ export default function(options) {
});
}
const SKIP = "skip";
function dataSource(term, opts) {
if (prevTerm === term) {
return SKIP;