From 1d37f9bbec8e232f00e58002f53ebca40d4bf369 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 20 Sep 2018 12:36:37 -0400 Subject: [PATCH] Close channel autocomplete if multiple tildes are typed (#2138) --- app/selectors/autocomplete.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/selectors/autocomplete.js b/app/selectors/autocomplete.js index 0bfeb74e8..e96c540fd 100644 --- a/app/selectors/autocomplete.js +++ b/app/selectors/autocomplete.js @@ -46,7 +46,13 @@ export const getMatchTermForChannelMention = (() => { lastValue = value; lastIsSearch = isSearch; if (match) { - lastMatchTerm = isSearch ? match[1] : match[2]; + if (isSearch) { + lastMatchTerm = match[1]; + } else if (match.index > 0 && value[match.index - 1] === '~') { + lastMatchTerm = null; + } else { + lastMatchTerm = match[2]; + } } else { lastMatchTerm = null; }