From 399865923658319d6d12a7719bc3b5554218bbad Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 4 Aug 2017 14:03:41 -0400 Subject: PLT-7267 Refactored tracking of recent emojis to hide deleted emojis (#7102) * Fixed local ESLint error * PLT-7267 Refactored tracking of recent emojis to hide deleted emojis --- webapp/actions/post_actions.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'webapp/actions') diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index e96e8306b..60913b171 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -11,8 +11,8 @@ import TeamStore from 'stores/team_store.jsx'; import {loadNewDMIfNeeded, loadNewGMIfNeeded} from 'actions/user_actions.jsx'; import {sendDesktopNotification} from 'actions/notification_actions.jsx'; -import Constants from 'utils/constants.jsx'; -const ActionTypes = Constants.ActionTypes; +import {ActionTypes, Constants} from 'utils/constants.jsx'; +import {EMOJI_PATTERN} from 'utils/emoticons.jsx'; import {browserHistory} from 'react-router/es6'; @@ -164,6 +164,15 @@ export function removeReaction(channelId, postId, emojiName) { } export function createPost(post, files, success) { + // parse message and emit emoji event + const emojis = post.message.match(EMOJI_PATTERN); + if (emojis) { + for (const emoji of emojis) { + const trimmed = emoji.substring(1, emoji.length - 1); + emitEmojiPosted(trimmed); + } + } + PostActions.createPost(post, files)(dispatch, getState).then(() => { if (post.root_id) { PostStore.storeCommentDraft(post.root_id, null); -- cgit v1.2.3-1-g7c22