return (state, ownProps) => { const config = getConfig(state); const currentChannel = getCurrentChannel(state) || {}; const draft = getPostDraft(state, StoragePrefixes.DRAFT, currentChannel.id); const recentPostIdInChannel = getMostRecentPostIdInChannel(state, currentChannel.id); const post = getPost(state, recentPostIdInChannel); const getCommentCountForPost = makeGetCommentCountForPost(); const latestReplyablePostId = getLatestReplyablePostId(state); const currentChannelMembersCount = getCurrentChannelStats(state) ? getCurrentChannelStats(state).member_count : 1; const enableTutorial = config.EnableTutorial === 'true'; const tutorialStep = getInt(state, Preferences.TUTORIAL_STEP, getCurrentUserId(state), TutorialSteps.FINISHED); const enableEmojiPicker = config.EnableEmojiPicker === 'true'; const enableGifPicker = config.EnableGifPicker === 'true'; const enableConfirmNotificationsToChannel = config.EnableConfirmNotificationsToChannel === 'true'; const currentUserId = getCurrentUserId(state); const userIsOutOfOffice = getStatusForUserId(state, currentUserId) === UserStatuses.OUT_OF_OFFICE; const badConnection = connectionErrorCount(state) > 1; const isTimezoneEnabled = config.ExperimentalTimezone === 'true'; return { currentTeamId: getCurrentTeamId(state), currentChannel, currentChannelMembersCount, currentUserId, codeBlockOnCtrlEnter: getBool(state, PreferencesRedux.CATEGORY_ADVANCED_SETTINGS, 'code_block_ctrl_enter', true), ctrlSend: getBool(state, Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter'), fullWidthTextBox: get(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_FULL_SCREEN, showTutorialTip: enableTutorial && tutorialStep === TutorialSteps.POST_POPOVER, messageInHistoryItem: makeGetMessageInHistoryItem(Posts.MESSAGE_TYPES.POST)(state), draft, recentPostIdInChannel, commentCountForPost: getCommentCountForPost(state, {post}), latestReplyablePostId, locale: getCurrentLocale(state), currentUsersLatestPost: getCurrentUsersLatestPost(state), readOnlyChannel: ownProps.readOnlyChannel || (!isCurrentUserSystemAdmin(state) && config.ExperimentalTownSquareIsReadOnly === 'true' && currentChannel.name === Constants.DEFAULT_CHANNEL), canUploadFiles: canUploadFiles(config), enableEmojiPicker, enableGifPicker, enableConfirmNotificationsToChannel, maxPostSize: parseInt(config.MaxPostSize, 10) || Constants.DEFAULT_CHARACTER_LIMIT, userIsOutOfOffice, rhsExpanded: getIsRhsExpanded(state), emojiMap: getEmojiMap(state), badConnection, isTimezoneEnabled, }; };
function mapStateToProps(state) { return { emojiMap: getEmojiMap(state), }; }