From 12e48ca7b297f83ebbf65cb25a65b396b94f75d4 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Tue, 6 Sep 2016 16:41:10 -0400
Subject: Allowed post formatting to be disabled regardless of whether
 EnableDeveloper is set (#3975)

---
 webapp/components/channel_header.jsx | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'webapp/components/channel_header.jsx')

diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 05a487756..add088913 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -29,8 +29,7 @@ import Client from 'client/web_client.jsx';
 import * as AsyncClient from 'utils/async_client.jsx';
 import {getFlaggedPosts} from 'actions/post_actions.jsx';
 
-import Constants from 'utils/constants.jsx';
-const ActionTypes = Constants.ActionTypes;
+import {ActionTypes, Constants, Preferences} from 'utils/constants.jsx';
 
 import React from 'react';
 import {FormattedMessage} from 'react-intl';
@@ -64,7 +63,8 @@ export default class ChannelHeader extends React.Component {
             memberChannel: ChannelStore.getMember(this.props.channelId),
             users: extraInfo.members,
             userCount: extraInfo.member_count,
-            currentUser: UserStore.getCurrentUser()
+            currentUser: UserStore.getCurrentUser(),
+            enableFormatting: PreferenceStore.getBool(Preferences.CATEGORY_ADVANCED_SETTINGS, 'formatting', true)
         };
     }
 
@@ -524,6 +524,13 @@ export default class ChannelHeader extends React.Component {
             }
         }
 
+        let headerText;
+        if (this.state.enableFormatting) {
+            headerText = TextFormatting.formatText(channel.header, {singleline: true, mentionHighlight: false, siteURL: Utils.getSiteURL()});
+        } else {
+            headerText = channel.header;
+        }
+
         return (
             <div
                 id='channel-header'
@@ -564,7 +571,7 @@ export default class ChannelHeader extends React.Component {
                                         <div
                                             onClick={Utils.handleFormattedTextClick}
                                             className='description'
-                                            dangerouslySetInnerHTML={{__html: TextFormatting.formatText(channel.header, {singleline: true, mentionHighlight: false, siteURL: Utils.getSiteURL()})}}
+                                            dangerouslySetInnerHTML={{__html: headerText}}
                                         />
                                     </OverlayTrigger>
                                 </div>
-- 
cgit v1.2.3-1-g7c22

