mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 11:03:40 +08:00
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:
parent
67cc6731c6
commit
43a41f3928
|
@ -29,6 +29,7 @@ import { emojiUrlFor } from "discourse/lib/text";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
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
|
// Our head can be a static string or a function that returns a string
|
||||||
// based on input (like for numbered lists).
|
// based on input (like for numbered lists).
|
||||||
|
@ -480,7 +481,7 @@ export default Component.extend({
|
||||||
term = term.toLowerCase();
|
term = term.toLowerCase();
|
||||||
|
|
||||||
if (term.length < this.siteSettings.emoji_autocomplete_min_chars) {
|
if (term.length < this.siteSettings.emoji_autocomplete_min_chars) {
|
||||||
return resolve([]);
|
return resolve(SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term === "") {
|
if (term === "") {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Site from "discourse/models/site";
|
||||||
@module $.fn.autocomplete
|
@module $.fn.autocomplete
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
export const SKIP = "skip";
|
||||||
export const CANCELLED_STATUS = "__CANCELLED";
|
export const CANCELLED_STATUS = "__CANCELLED";
|
||||||
const allowedLettersRegex = /[\s\t\[\{\(\/]/;
|
const allowedLettersRegex = /[\s\t\[\{\(\/]/;
|
||||||
|
|
||||||
|
@ -352,8 +353,6 @@ export default function(options) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const SKIP = "skip";
|
|
||||||
|
|
||||||
function dataSource(term, opts) {
|
function dataSource(term, opts) {
|
||||||
if (prevTerm === term) {
|
if (prevTerm === term) {
|
||||||
return SKIP;
|
return SKIP;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user