From e3b8511462552dddabe257ee16d74492fdaedb2c Mon Sep 17 00:00:00 2001
From: George Goldberg <george@gberg.me>
Date: Mon, 2 Jan 2017 22:35:26 +0000
Subject: PLT-4990 (WebApp): Separate channel management permissions. (#4865)

---
 webapp/components/channel_header.jsx | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

(limited to 'webapp/components/channel_header.jsx')

diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 52bed85cd..555b539cd 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -206,30 +206,6 @@ export default class ChannelHeader extends React.Component {
         });
     }
 
-    showManagementOptions(channel, isAdmin, isSystemAdmin) {
-        if (global.window.mm_license.IsLicensed !== 'true') {
-            return true;
-        }
-
-        if (channel.type === Constants.OPEN_CHANNEL) {
-            if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
-                return false;
-            }
-            if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
-                return false;
-            }
-        } else if (channel.type === Constants.PRIVATE_CHANNEL) {
-            if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
-                return false;
-            }
-            if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
     initWebrtc(contactId, isOnline) {
         if (isOnline && !this.state.isBusy) {
             GlobalActions.emitCloseRightHandSide();
@@ -521,7 +497,7 @@ export default class ChannelHeader extends React.Component {
                 </li>
             );
 
-            if (this.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
+            if (ChannelUtils.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
                 dropdownContents.push(
                     <li
                         key='set_channel_header'
@@ -584,7 +560,9 @@ export default class ChannelHeader extends React.Component {
                         </a>
                     </li>
                 );
+            }
 
+            if (ChannelUtils.showDeleteOption(channel, isAdmin, isSystemAdmin)) {
                 if (!ChannelStore.isDefault(channel)) {
                     dropdownContents.push(deleteOption);
                 }
-- 
cgit v1.2.3-1-g7c22

