summaryrefslogtreecommitdiffstats
path: root/webapp/utils/channel_intro_messages.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/channel_intro_messages.jsx')
-rw-r--r--webapp/utils/channel_intro_messages.jsx32
1 files changed, 29 insertions, 3 deletions
diff --git a/webapp/utils/channel_intro_messages.jsx b/webapp/utils/channel_intro_messages.jsx
index 64d250943..c6a3d7547 100644
--- a/webapp/utils/channel_intro_messages.jsx
+++ b/webapp/utils/channel_intro_messages.jsx
@@ -14,6 +14,8 @@ import * as GlobalActions from 'actions/global_actions.jsx';
import Client from 'client/web_client.jsx';
import ProfilePicture from 'components/profile_picture.jsx';
+import {showManagementOptions} from './channel_utils.jsx';
+
import React from 'react';
import {FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'react-intl';
@@ -157,6 +159,15 @@ export function createOffTopicIntroMessage(channel, centeredIntro) {
/>
);
+ const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
+ const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
+ const isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel();
+
+ let setHeaderButton = createSetHeaderButton(channel);
+ if (!showManagementOptions(channel, isAdmin, isSystemAdmin, isChannelAdmin)) {
+ setHeaderButton = null;
+ }
+
return (
<div className={'channel-intro ' + centeredIntro}>
<FormattedHTMLMessage
@@ -167,7 +178,7 @@ export function createOffTopicIntroMessage(channel, centeredIntro) {
}}
/>
{createInviteChannelMemberButton(channel, uiType)}
- {createSetHeaderButton(channel)}
+ {setHeaderButton}
</div>
);
}
@@ -189,6 +200,7 @@ export function createDefaultIntroMessage(channel, centeredIntro) {
const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
+ const isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel();
if (global.window.mm_license.IsLicensed === 'true') {
if (global.window.mm_config.RestrictTeamInvite === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
@@ -198,6 +210,11 @@ export function createDefaultIntroMessage(channel, centeredIntro) {
}
}
+ let setHeaderButton = createSetHeaderButton(channel);
+ if (!showManagementOptions(channel, isAdmin, isSystemAdmin, isChannelAdmin)) {
+ setHeaderButton = null;
+ }
+
return (
<div className={'channel-intro ' + centeredIntro}>
<FormattedHTMLMessage
@@ -208,7 +225,7 @@ export function createDefaultIntroMessage(channel, centeredIntro) {
}}
/>
{inviteModalLink}
- {createSetHeaderButton(channel)}
+ {setHeaderButton}
<br/>
</div>
);
@@ -303,6 +320,15 @@ export function createStandardIntroMessage(channel, centeredIntro) {
);
}
+ const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
+ const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
+ const isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel();
+
+ let setHeaderButton = createSetHeaderButton(channel);
+ if (!showManagementOptions(channel, isAdmin, isSystemAdmin, isChannelAdmin)) {
+ setHeaderButton = null;
+ }
+
return (
<div className={'channel-intro ' + centeredIntro}>
<h4 className='channel-intro__title'>
@@ -321,7 +347,7 @@ export function createStandardIntroMessage(channel, centeredIntro) {
<br/>
</p>
{createInviteChannelMemberButton(channel, uiType)}
- {createSetHeaderButton(channel)}
+ {setHeaderButton}
</div>
);
}