From 6a4d1713e666bf2d8d6ea10573d0b3b2a2959c62 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Tue, 1 Nov 2016 14:28:25 -0400
Subject: Fixing demotion message (#4410)

---
 webapp/components/admin_console/admin_team_members_dropdown.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'webapp/components/admin_console/admin_team_members_dropdown.jsx')

diff --git a/webapp/components/admin_console/admin_team_members_dropdown.jsx b/webapp/components/admin_console/admin_team_members_dropdown.jsx
index 141e85857..dffc0573a 100644
--- a/webapp/components/admin_console/admin_team_members_dropdown.jsx
+++ b/webapp/components/admin_console/admin_team_members_dropdown.jsx
@@ -69,7 +69,7 @@ export default class AdminTeamMembersDropdown extends React.Component {
     handleMakeMember(e) {
         e.preventDefault();
         const me = UserStore.getCurrentUser();
-        if (this.props.user.id === me.id) {
+        if (this.props.user.id === me.id && me.roles.includes('system_admin')) {
             this.handleDemoteSystemAdmin(this.props.user, 'member');
         } else {
             this.doMakeMember();
@@ -131,7 +131,7 @@ export default class AdminTeamMembersDropdown extends React.Component {
     handleMakeTeamAdmin(e) {
         e.preventDefault();
         const me = UserStore.getCurrentUser();
-        if (this.props.user.id === me.id) {
+        if (this.props.user.id === me.id && me.roles.includes('system_admin')) {
             this.handleDemoteSystemAdmin(this.props.user, 'teamadmin');
         } else {
             this.doMakeTeamAdmin();
-- 
cgit v1.2.3-1-g7c22

