Moved PreferenceStore initialization into head.html

This commit is contained in:
hmhealey
2016-01-26 09:52:26 -05:00
parent a6c97490b3
commit c889d9bee1
3 changed files with 7 additions and 6 deletions

View File

@@ -18,8 +18,6 @@ import RegisterAppModal from '../components/register_app_modal.jsx';
import ImportThemeModal from '../components/user_settings/import_theme_modal.jsx';
import InviteMemberModal from '../components/invite_member_modal.jsx';
import PreferenceStore from '../stores/preference_store.jsx';
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
var IntlProvider = ReactIntl.IntlProvider;
@@ -88,15 +86,13 @@ class Root extends React.Component {
}
}
global.window.setup_channel_page = function setup(props, team, channel, preferences) {
global.window.setup_channel_page = function setup(props, team, channel) {
if (props.PostId === '') {
EventHelpers.emitChannelClickEvent(channel);
} else {
EventHelpers.emitPostFocusEvent(props.PostId);
}
PreferenceStore.setPreferences(preferences);
ReactDOM.render(
<Root map={props} />,
document.getElementById('channel_view')

View File

@@ -6,7 +6,7 @@
<body>
<div id="channel_view" class='channel-view'></div>
<script>
window.setup_channel_page({{ .Props }}, {{ .Team }}, {{ .Channel }}, {{ .Preferences }});
window.setup_channel_page({{ .Props }}, {{ .Team }}, {{ .Channel }});
$('body').tooltip( {selector: '[data-toggle=tooltip]'} );
var modals = $('.modal-body').not('.edit-modal-body');
if($(window).height() > 1200){

View File

@@ -74,6 +74,11 @@
window.mm_user = {{ .User }};
window.mm_channel = {{ .Channel }};
window.mm_locale = {{ .Locale }};
window.mm_preferences = {{ .Preferences }};
$(function() {
PreferenceStore.setPreferences(window.mm_preferences);
});
if ({{.SessionTokenIndex}} >= 0) {
window.mm_session_token_index = {{.SessionTokenIndex}};