From a3171048e089fba22360e90fe5312be344ab1739 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Mon, 5 Jun 2017 16:34:43 -0400
Subject: PLT-6724 Hide options relating to channel admin when not licensed
 (#6583)

---
 .../channel_members_dropdown.jsx                     | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

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

diff --git a/webapp/components/channel_members_dropdown/channel_members_dropdown.jsx b/webapp/components/channel_members_dropdown/channel_members_dropdown.jsx
index c327f9f81..86efc8367 100644
--- a/webapp/components/channel_members_dropdown/channel_members_dropdown.jsx
+++ b/webapp/components/channel_members_dropdown/channel_members_dropdown.jsx
@@ -80,15 +80,6 @@ export default class ChannelMembersDropdown extends React.Component {
         );
     }
 
-    // Checks if the user this menu is for is a channel admin or not.
-    isChannelAdmin() {
-        if (Utils.isChannelAdmin(this.props.channelMember.roles)) {
-            return true;
-        }
-
-        return false;
-    }
-
     // Checks if the current user has the power to change the roles of this member.
     canChangeMemberRoles() {
         if (UserStore.isSystemAdminForCurrentUser()) {
@@ -108,6 +99,9 @@ export default class ChannelMembersDropdown extends React.Component {
     }
 
     render() {
+        const supportsChannelAdmin = global.mm_license.IsLicensed === 'true';
+        const isChannelAdmin = supportsChannelAdmin && Utils.isChannelAdmin(this.props.channelMember.roles);
+
         let serverError = null;
         if (this.state.serverError) {
             serverError = (
@@ -129,7 +123,7 @@ export default class ChannelMembersDropdown extends React.Component {
                 />
             );
 
-            if (this.isChannelAdmin()) {
+            if (isChannelAdmin) {
                 role = (
                     <FormattedMessage
                         id='channel_members_dropdown.channel_admin'
@@ -158,7 +152,7 @@ export default class ChannelMembersDropdown extends React.Component {
             }
 
             let makeChannelMember = null;
-            if (this.isChannelAdmin()) {
+            if (isChannelAdmin) {
                 makeChannelMember = (
                     <li role='presentation'>
                         <a
@@ -177,7 +171,7 @@ export default class ChannelMembersDropdown extends React.Component {
             }
 
             let makeChannelAdmin = null;
-            if (!this.isChannelAdmin()) {
+            if (supportsChannelAdmin && !isChannelAdmin) {
                 makeChannelAdmin = (
                     <li role='presentation'>
                         <a
@@ -233,7 +227,7 @@ export default class ChannelMembersDropdown extends React.Component {
                     />
                 </button>
             );
-        } else if (this.isChannelAdmin()) {
+        } else if (isChannelAdmin) {
             if (this.props.channel.name === Constants.DEFAULT_CHANNEL) {
                 return (
                     <div/>
-- 
cgit v1.2.3-1-g7c22

