summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hopkins <thomchop@users.noreply.github.com>2016-11-02 03:47:12 -0700
committerJoram Wilander <jwawilander@gmail.com>2016-11-02 06:47:11 -0400
commitb05f82e2310284165d4bdcbde729be0c3fff34b0 (patch)
tree033eeb315eb162aed7024172cd417560a3c9dfde
parent1d0303cfb5a16c5b8ef302ab623e9452db3f3cc8 (diff)
downloadchat-b05f82e2310284165d4bdcbde729be0c3fff34b0.tar.gz
chat-b05f82e2310284165d4bdcbde729be0c3fff34b0.tar.bz2
chat-b05f82e2310284165d4bdcbde729be0c3fff34b0.zip
PLT-4098 Don't show @mention suggestions if word chars immediately precede at sign (#4399)
* PLT-4098 Don't show @mention suggestions if word chars immediately precede at sign * PLT-4098 Simplify detection of word chars preceding @mentions
-rw-r--r--webapp/components/suggestion/at_mention_provider.jsx4
1 files changed, 2 insertions, 2 deletions
diff --git a/webapp/components/suggestion/at_mention_provider.jsx b/webapp/components/suggestion/at_mention_provider.jsx
index d4f441f98..d1a03deb5 100644
--- a/webapp/components/suggestion/at_mention_provider.jsx
+++ b/webapp/components/suggestion/at_mention_provider.jsx
@@ -112,7 +112,7 @@ export default class AtMentionProvider {
handlePretextChanged(suggestionId, pretext) {
clearTimeout(this.timeoutId);
- const captured = (/@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase());
+ const captured = (/(?:^|\W)@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase());
if (captured) {
const prefix = captured[1];
@@ -146,7 +146,7 @@ export default class AtMentionProvider {
AppDispatcher.handleServerAction({
type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS,
id: suggestionId,
- matchedPretext: captured[0],
+ matchedPretext: `@${captured[1]}`,
terms: mentions,
items: users,
component: AtMentionSuggestion