diff options
Diffstat (limited to 'webapp/components/post_view/post_message_view/index.js')
-rw-r--r-- | webapp/components/post_view/post_message_view/index.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/webapp/components/post_view/post_message_view/index.js b/webapp/components/post_view/post_message_view/index.js new file mode 100644 index 000000000..cf457a508 --- /dev/null +++ b/webapp/components/post_view/post_message_view/index.js @@ -0,0 +1,41 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {connect} from 'react-redux'; +import {getCustomEmojisAsMap} from 'mattermost-redux/selectors/entities/emojis'; +import {getBool} from 'mattermost-redux/selectors/entities/preferences'; +import {getCurrentUserMentionKeys, getUsersByUsername} from 'mattermost-redux/selectors/entities/users'; + +import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams'; + +import {Preferences} from 'mattermost-redux/constants'; +import {getSiteURL} from 'utils/url.jsx'; + +import {EmojiMap} from 'stores/emoji_store.jsx'; + +import PostMessageView from './post_message_view.jsx'; + +function makeMapStateToProps() { + let emojiMap; + let oldCustomEmoji; + + return function mapStateToProps(state, ownProps) { + const newCustomEmoji = getCustomEmojisAsMap(state); + if (newCustomEmoji !== oldCustomEmoji) { + emojiMap = new EmojiMap(newCustomEmoji); + } + oldCustomEmoji = newCustomEmoji; + + return { + ...ownProps, + emojis: emojiMap, + enableFormatting: getBool(state, Preferences.CATEGORY_ADVANCED_SETTINGS, 'formatting', true), + mentionKeys: getCurrentUserMentionKeys(state), + usernameMap: getUsersByUsername(state), + team: getCurrentTeam(state), + siteUrl: getSiteURL() + }; + }; +} + +export default connect(makeMapStateToProps)(PostMessageView); |