diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-01-20 08:19:23 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-01-20 08:19:23 -0500 |
commit | 23e7414d356839a4866c978b676abafb0f6bbfa9 (patch) | |
tree | 39ac42d4f65abb164707d04f20c20e64c5f38f0a /webapp/components/suggestion/channel_mention_provider.jsx | |
parent | 576c662f27d237e1f173d331aade6ab697911395 (diff) | |
download | chat-23e7414d356839a4866c978b676abafb0f6bbfa9.tar.gz chat-23e7414d356839a4866c978b676abafb0f6bbfa9.tar.bz2 chat-23e7414d356839a4866c978b676abafb0f6bbfa9.zip |
Fixed channel mention autocomplete to not match completed mentions (#5101)
Diffstat (limited to 'webapp/components/suggestion/channel_mention_provider.jsx')
-rw-r--r-- | webapp/components/suggestion/channel_mention_provider.jsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/webapp/components/suggestion/channel_mention_provider.jsx b/webapp/components/suggestion/channel_mention_provider.jsx index 63e6944ac..611f3de10 100644 --- a/webapp/components/suggestion/channel_mention_provider.jsx +++ b/webapp/components/suggestion/channel_mention_provider.jsx @@ -56,6 +56,18 @@ export default class ChannelMentionProvider extends Provider { if (captured) { const prefix = captured[3]; + if ((/\s/).test(prefix)) { + // If there's a space, there's a chance that we've already completed this mention + const firstWordOfPrefix = prefix.split(' ')[0]; + + for (const channel of ChannelStore.getChannels()) { + if (firstWordOfPrefix === channel.name) { + // We've already mentioned this channel so there's nothing else to look for + return; + } + } + } + this.startNewRequest(prefix); autocompleteChannels( |