summaryrefslogtreecommitdiffstats
path: root/webapp/components/suggestion/channel_mention_provider.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/suggestion/channel_mention_provider.jsx')
-rw-r--r--webapp/components/suggestion/channel_mention_provider.jsx12
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(