summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-12-04 08:21:39 -0500
committerJoram Wilander <jwawilander@gmail.com>2015-12-04 08:21:39 -0500
commit04727955cd73864d23be9da7fb999d23e93a20e0 (patch)
tree60f7b58a68693a7b80853ec88f533264c104e9ae /web/react/utils
parent93db32da7b97f4d4c10afc17f48c2221eefb54c7 (diff)
parentbc173ebcb47f60d5e99081156575a8ace98fe168 (diff)
downloadchat-04727955cd73864d23be9da7fb999d23e93a20e0.tar.gz
chat-04727955cd73864d23be9da7fb999d23e93a20e0.tar.bz2
chat-04727955cd73864d23be9da7fb999d23e93a20e0.zip
Merge pull request #1600 from hmhealey/plt1152
PLT-1152 Fix cross-contamination between invite member modals
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/channel_intro_messages.jsx (renamed from web/react/utils/channel_intro_mssages.jsx)39
1 files changed, 20 insertions, 19 deletions
diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_messages.jsx
index 6f83778c9..9685f94b0 100644
--- a/web/react/utils/channel_intro_mssages.jsx
+++ b/web/react/utils/channel_intro_messages.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
import * as Utils from './utils.jsx';
+import ChannelInviteModal from '../components/channel_invite_modal.jsx';
import EditChannelHeaderModal from '../components/edit_channel_header_modal.jsx';
import ToggleModalButton from '../components/toggle_modal_button.jsx';
import UserProfile from '../components/user_profile.jsx';
@@ -10,15 +11,15 @@ import Constants from '../utils/constants.jsx';
import TeamStore from '../stores/team_store.jsx';
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
-export function createChannelIntroMessage(channel, showInviteModal) {
+export function createChannelIntroMessage(channel) {
if (channel.type === 'D') {
return createDMIntroMessage(channel);
} else if (ChannelStore.isDefault(channel)) {
return createDefaultIntroMessage(channel);
} else if (channel.name === Constants.OFFTOPIC_CHANNEL) {
- return createOffTopicIntroMessage(channel, showInviteModal);
+ return createOffTopicIntroMessage(channel);
} else if (channel.type === 'O' || channel.type === 'P') {
- return createStandardIntroMessage(channel, showInviteModal);
+ return createStandardIntroMessage(channel);
}
}
@@ -62,7 +63,7 @@ export function createDMIntroMessage(channel) {
);
}
-export function createOffTopicIntroMessage(channel, showInviteModal) {
+export function createOffTopicIntroMessage(channel) {
return (
<div className='channel-intro'>
<h4 className='channel-intro__title'>{'Beginning of ' + channel.display_name}</h4>
@@ -71,13 +72,7 @@ export function createOffTopicIntroMessage(channel, showInviteModal) {
<br/>
</p>
{createSetHeaderButton(channel)}
- <a
- href='#'
- className='intro-links'
- onClick={showInviteModal}
- >
- <i className='fa fa-user-plus'></i>{'Invite others to this channel'}
- </a>
+ {createInviteChannelMemberButton(channel, 'channel')}
</div>
);
}
@@ -122,7 +117,7 @@ export function createDefaultIntroMessage(channel) {
);
}
-export function createStandardIntroMessage(channel, showInviteModal) {
+export function createStandardIntroMessage(channel) {
var uiName = channel.display_name;
var creatorName = '';
@@ -162,17 +157,23 @@ export function createStandardIntroMessage(channel, showInviteModal) {
<br/>
</p>
{createSetHeaderButton(channel)}
- <a
- className='intro-links'
- href='#'
- onClick={showInviteModal}
- >
- <i className='fa fa-user-plus'></i>{'Invite others to this ' + uiType}
- </a>
+ {createInviteChannelMemberButton(channel, uiType)}
</div>
);
}
+function createInviteChannelMemberButton(channel, uiType) {
+ return (
+ <ToggleModalButton
+ className='intro-links'
+ dialogType={ChannelInviteModal}
+ dialogProps={{channel}}
+ >
+ <i className='fa fa-user-plus'></i>{'Invite others to this ' + uiType}
+ </ToggleModalButton>
+ );
+}
+
function createSetHeaderButton(channel) {
return (
<ToggleModalButton