// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import * as Utils from './utils.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, showInviteModal) { 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); } else if (channel.type === 'O' || channel.type === 'P') { return createStandardIntroMessage(channel, showInviteModal); } } 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, showInviteModal) { return (

{'Beginning of ' + channel.display_name}

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

{createSetHeaderButton(channel)} {'Invite others to this 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, showInviteModal) { 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)} {'Invite others to this ' + uiType}
); } function createSetHeaderButton(channel) { return ( {'Set a header'} ); }