// 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'; import {FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'mm-intl'; 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 (

{createSetHeaderButton(channel)}
); } return (

); } export function createOffTopicIntroMessage(channel) { return (
{createSetHeaderButton(channel)} {createInviteChannelMemberButton(channel, 'channel')}
); } export function createDefaultIntroMessage(channel) { const team = TeamStore.getCurrent(); let inviteModalLink; if (team.type === Constants.INVITE_TEAM) { inviteModalLink = ( ); } else { inviteModalLink = ( ); } return (
{inviteModalLink} {createSetHeaderButton(channel)}
); } export function createStandardIntroMessage(channel) { var uiName = channel.display_name; var creatorName = ''; var uiType; var memberMessage; if (channel.type === 'P') { uiType = ( ); memberMessage = ( ); } else { uiType = ( ); memberMessage = ( ); } const date = ( ); var createMessage; if (creatorName === '') { createMessage = ( ); } else { createMessage = ( ); } return (

{createMessage} {memberMessage}

{createSetHeaderButton(channel)} {createInviteChannelMemberButton(channel, uiType)}
); } function createInviteChannelMemberButton(channel, uiType) { return ( ); } function createSetHeaderButton(channel) { return ( ); }