From 7a09b4bd783495e705f1a590a70d5729ce447356 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Tue, 4 Jul 2017 04:01:27 -0400
Subject: Make channel switcher partially obey RestrictDirectMessage setting
 (#6830)

---
 webapp/components/suggestion/switch_channel_provider.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'webapp/components/suggestion/switch_channel_provider.jsx')

diff --git a/webapp/components/suggestion/switch_channel_provider.jsx b/webapp/components/suggestion/switch_channel_provider.jsx
index 8412332ea..346721cd6 100644
--- a/webapp/components/suggestion/switch_channel_provider.jsx
+++ b/webapp/components/suggestion/switch_channel_provider.jsx
@@ -121,7 +121,11 @@ export default class SwitchChannelProvider extends Provider {
     }
 
     async fetchUsersAndChannels(channelPrefix, suggestionId) {
-        const usersAsync = Client4.autocompleteUsers(channelPrefix, '', '');
+        let teamId = '';
+        if (global.window.mm_config.RestrictDirectMessage === 'team') {
+            teamId = store.getState().entities.teams.currentTeamId;
+        }
+        const usersAsync = Client4.autocompleteUsers(channelPrefix, teamId, '');
         const channelsAsync = Client4.searchChannels(getCurrentTeamId(getState()), channelPrefix);
 
         let usersFromServer = [];
-- 
cgit v1.2.3-1-g7c22

