From e8f6dd2f3359feceeae9923366c5ec80a6ab1d73 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Tue, 17 Nov 2015 09:17:00 -0500
Subject: Cleaned up how channel intro messages display set channel header
 button

---
 web/react/utils/channel_intro_mssages.jsx | 45 ++++++++++++-------------------
 1 file changed, 17 insertions(+), 28 deletions(-)

(limited to 'web/react/utils/channel_intro_mssages.jsx')

diff --git a/web/react/utils/channel_intro_mssages.jsx b/web/react/utils/channel_intro_mssages.jsx
index 268e4f695..72328f812 100644
--- a/web/react/utils/channel_intro_mssages.jsx
+++ b/web/react/utils/channel_intro_mssages.jsx
@@ -3,6 +3,7 @@
 
 import * as Utils from './utils.jsx';
 import EditChannelHeaderModal from '../components/edit_channel_header_modal.jsx';
+import GetTeamInviteLinkModal from '../components/get_team_invite_link_modal.jsx';
 import InviteMemberModal from '../components/invite_member_modal.jsx';
 import ToggleModalButton from '../components/toggle_modal_button.jsx';
 import UserProfile from '../components/user_profile.jsx';
@@ -50,13 +51,7 @@ export function createDMIntroMessage(channel) {
                     {'This is the start of your direct message history with ' + teammateName + '.'}<br/>
                     {'Direct messages and files shared here are not shown to people outside this area.'}
                 </p>
-                <ToggleModalButton
-                    className='intro-links'
-                    dialogType={EditChannelHeaderModal}
-                    dialogProps={{channel}}
-                >
-                    <i className='fa fa-pencil'></i>{'Set a header'}
-                </ToggleModalButton>
+                {createSetHeaderButton(channel)}
             </div>
         );
     }
@@ -76,13 +71,7 @@ export function createOffTopicIntroMessage(channel, showInviteModal) {
                 {'This is the start of ' + channel.display_name + ', a channel for non-work-related conversations.'}
                 <br/>
             </p>
-            <ToggleModalButton
-                className='intro-links'
-                dialogType={EditChannelHeaderModal}
-                dialogProps={{channel}}
-            >
-                <i className='fa fa-pencil'></i>{'Set a header'}
-            </ToggleModalButton>
+            {createSetHeaderButton(channel)}
             <a
                 href='#'
                 className='intro-links'
@@ -131,13 +120,7 @@ export function createDefaultIntroMessage(channel) {
                 {'This is the first channel teammates see when they sign up - use it for posting updates everyone needs to know.'}
             </p>
             {inviteModalLink}
-            <ToggleModalButton
-                className='intro-links'
-                dialogType={EditChannelHeaderModal}
-                dialogProps={{channel}}
-            >
-                <i className='fa fa-pencil'></i>{'Set a header'}
-            </ToggleModalButton>
+            {createSetHeaderButton(channel)}
             <br/>
         </div>
     );
@@ -182,13 +165,7 @@ export function createStandardIntroMessage(channel, showInviteModal) {
                 {memberMessage}
                 <br/>
             </p>
-            <ToggleModalButton
-                className='intro-links'
-                dialogType={EditChannelHeaderModal}
-                dialogProps={{channel}}
-            >
-                <i className='fa fa-pencil'></i>{'Set a header'}
-            </ToggleModalButton>
+            {createSetHeaderButton(channel)}
             <a
                 className='intro-links'
                 href='#'
@@ -199,3 +176,15 @@ export function createStandardIntroMessage(channel, showInviteModal) {
         </div>
     );
 }
+
+function createSetHeaderButton(channel) {
+    return (
+        <ToggleModalButton
+            className='intro-links'
+            dialogType={EditChannelHeaderModal}
+            dialogProps={{channel}}
+        >
+            <i className='fa fa-pencil'></i>{'Set a header'}
+        </ToggleModalButton>
+    );
+}
-- 
cgit v1.2.3-1-g7c22

