From d09ace15f24c396fb60809185047adee6db1ab08 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 3 Dec 2015 10:31:05 -0500 Subject: Switched ChannelInviteModal to use a ToggleModalButton wherever possible --- web/react/utils/channel_intro_mssages.jsx | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_mssages.jsx index 6f83778c9..312e0d5d6 100644 --- a/web/react/utils/channel_intro_mssages.jsx +++ b/web/react/utils/channel_intro_mssages.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 (

{'Beginning of ' + channel.display_name}

@@ -71,13 +72,7 @@ export function createOffTopicIntroMessage(channel, showInviteModal) {

{createSetHeaderButton(channel)} - - {'Invite others to this channel'} - + {createInviteChannelMemberButton(channel, 'channel')}
); } @@ -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,22 @@ export function createStandardIntroMessage(channel, showInviteModal) {

{createSetHeaderButton(channel)} - - {'Invite others to this ' + uiType} - + {createInviteChannelMemberButton(channel, uiType)} ); } +function createInviteChannelMemberButton(channel, uiType) { + return ( + + {'Invite others to this ' + uiType} + + ); +} + function createSetHeaderButton(channel) { return ( Date: Thu, 3 Dec 2015 12:57:34 -0500 Subject: Removed some internal state from ChannelMembersModal and ChannelInviteModal --- web/react/utils/channel_intro_mssages.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'web/react/utils') diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_mssages.jsx index 312e0d5d6..9685f94b0 100644 --- a/web/react/utils/channel_intro_mssages.jsx +++ b/web/react/utils/channel_intro_mssages.jsx @@ -167,6 +167,7 @@ function createInviteChannelMemberButton(channel, uiType) { {'Invite others to this ' + uiType} -- cgit v1.2.3-1-g7c22 From bc173ebcb47f60d5e99081156575a8ace98fe168 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 3 Dec 2015 12:59:49 -0500 Subject: Renamed channel_intro_mssages.jsx to channel_intro_messages.jsx --- web/react/utils/channel_intro_messages.jsx | 187 +++++++++++++++++++++++++++++ web/react/utils/channel_intro_mssages.jsx | 187 ----------------------------- 2 files changed, 187 insertions(+), 187 deletions(-) create mode 100644 web/react/utils/channel_intro_messages.jsx delete mode 100644 web/react/utils/channel_intro_mssages.jsx (limited to 'web/react/utils') diff --git a/web/react/utils/channel_intro_messages.jsx b/web/react/utils/channel_intro_messages.jsx new file mode 100644 index 000000000..9685f94b0 --- /dev/null +++ b/web/react/utils/channel_intro_messages.jsx @@ -0,0 +1,187 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// 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'; +import ChannelStore from '../stores/channel_store.jsx'; +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) { + 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); + } else if (channel.type === 'O' || channel.type === 'P') { + return createStandardIntroMessage(channel); + } +} + +export function createDMIntroMessage(channel) { + var teammate = Utils.getDirectTeammate(channel.id); + + if (teammate) { + var teammateName = teammate.username; + if (teammate.nickname.length > 0) { + teammateName = teammate.nickname; + } + + return ( +
+
+ +
+
+ + + +
+

+ {'This is the start of your direct message history with ' + teammateName + '.'}
+ {'Direct messages and files shared here are not shown to people outside this area.'} +

+ {createSetHeaderButton(channel)} +
+ ); + } + + return ( +
+

{'This is the start of your direct message history with this teammate. Direct messages and files shared here are not shown to people outside this area.'}

+
+ ); +} + +export function createOffTopicIntroMessage(channel) { + return ( +
+

{'Beginning of ' + channel.display_name}

+

+ {'This is the start of ' + channel.display_name + ', a channel for non-work-related conversations.'} +
+

+ {createSetHeaderButton(channel)} + {createInviteChannelMemberButton(channel, 'channel')} +
+ ); +} + +export function createDefaultIntroMessage(channel) { + const team = TeamStore.getCurrent(); + let inviteModalLink; + if (team.type === Constants.INVITE_TEAM) { + inviteModalLink = ( + + {'Invite others to this team'} + + ); + } else { + inviteModalLink = ( + + {'Invite others to this team'} + + ); + } + + return ( +
+

{'Beginning of ' + channel.display_name}

+

+ {'Welcome to ' + channel.display_name + '!'} +

+ {'This is the first channel teammates see when they sign up - use it for posting updates everyone needs to know.'} +

+ {inviteModalLink} + {createSetHeaderButton(channel)} +
+
+ ); +} + +export function createStandardIntroMessage(channel) { + var uiName = channel.display_name; + var creatorName = ''; + + var uiType; + var memberMessage; + if (channel.type === 'P') { + uiType = 'private group'; + memberMessage = ' Only invited members can see this private group.'; + } else { + uiType = 'channel'; + memberMessage = ' Any member can join and read this channel.'; + } + + var createMessage; + if (creatorName === '') { + createMessage = 'This is the start of the ' + uiName + ' ' + uiType + ', created on ' + Utils.displayDate(channel.create_at) + '.'; + } else { + createMessage = ( + + {'This is the start of the '} + {uiName} + {' '} + {uiType}{', created by '} + {creatorName} + {' on '} + {Utils.displayDate(channel.create_at)} + + ); + } + + return ( +
+

{'Beginning of ' + uiName}

+

+ {createMessage} + {memberMessage} +
+

+ {createSetHeaderButton(channel)} + {createInviteChannelMemberButton(channel, uiType)} +
+ ); +} + +function createInviteChannelMemberButton(channel, uiType) { + return ( + + {'Invite others to this ' + uiType} + + ); +} + +function createSetHeaderButton(channel) { + return ( + + {'Set a header'} + + ); +} diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_mssages.jsx deleted file mode 100644 index 9685f94b0..000000000 --- a/web/react/utils/channel_intro_mssages.jsx +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// 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'; -import ChannelStore from '../stores/channel_store.jsx'; -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) { - 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); - } else if (channel.type === 'O' || channel.type === 'P') { - return createStandardIntroMessage(channel); - } -} - -export function createDMIntroMessage(channel) { - var teammate = Utils.getDirectTeammate(channel.id); - - if (teammate) { - var teammateName = teammate.username; - if (teammate.nickname.length > 0) { - teammateName = teammate.nickname; - } - - return ( -
-
- -
-
- - - -
-

- {'This is the start of your direct message history with ' + teammateName + '.'}
- {'Direct messages and files shared here are not shown to people outside this area.'} -

- {createSetHeaderButton(channel)} -
- ); - } - - return ( -
-

{'This is the start of your direct message history with this teammate. Direct messages and files shared here are not shown to people outside this area.'}

-
- ); -} - -export function createOffTopicIntroMessage(channel) { - return ( -
-

{'Beginning of ' + channel.display_name}

-

- {'This is the start of ' + channel.display_name + ', a channel for non-work-related conversations.'} -
-

- {createSetHeaderButton(channel)} - {createInviteChannelMemberButton(channel, 'channel')} -
- ); -} - -export function createDefaultIntroMessage(channel) { - const team = TeamStore.getCurrent(); - let inviteModalLink; - if (team.type === Constants.INVITE_TEAM) { - inviteModalLink = ( - - {'Invite others to this team'} - - ); - } else { - inviteModalLink = ( - - {'Invite others to this team'} - - ); - } - - return ( -
-

{'Beginning of ' + channel.display_name}

-

- {'Welcome to ' + channel.display_name + '!'} -

- {'This is the first channel teammates see when they sign up - use it for posting updates everyone needs to know.'} -

- {inviteModalLink} - {createSetHeaderButton(channel)} -
-
- ); -} - -export function createStandardIntroMessage(channel) { - var uiName = channel.display_name; - var creatorName = ''; - - var uiType; - var memberMessage; - if (channel.type === 'P') { - uiType = 'private group'; - memberMessage = ' Only invited members can see this private group.'; - } else { - uiType = 'channel'; - memberMessage = ' Any member can join and read this channel.'; - } - - var createMessage; - if (creatorName === '') { - createMessage = 'This is the start of the ' + uiName + ' ' + uiType + ', created on ' + Utils.displayDate(channel.create_at) + '.'; - } else { - createMessage = ( - - {'This is the start of the '} - {uiName} - {' '} - {uiType}{', created by '} - {creatorName} - {' on '} - {Utils.displayDate(channel.create_at)} - - ); - } - - return ( -
-

{'Beginning of ' + uiName}

-

- {createMessage} - {memberMessage} -
-

- {createSetHeaderButton(channel)} - {createInviteChannelMemberButton(channel, uiType)} -
- ); -} - -function createInviteChannelMemberButton(channel, uiType) { - return ( - - {'Invite others to this ' + uiType} - - ); -} - -function createSetHeaderButton(channel) { - return ( - - {'Set a header'} - - ); -} -- cgit v1.2.3-1-g7c22