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
Этот коммит содержится в:
Harrison Healey
2017-08-04 14:03:41 -04:00
коммит произвёл Christopher Speller
родитель 2c8a5ffd97
Коммит 3998659236
7 изменённых файлов: 96 добавлений и 113 удалений

Просмотреть файл

@@ -31,7 +31,7 @@ import {browserHistory} from 'react-router/es6';
const ActionTypes = Constants.ActionTypes;
const KeyCodes = Constants.KeyCodes;
import {REACTION_PATTERN, EMOJI_PATTERN} from 'components/create_post.jsx';
import {REACTION_PATTERN} from 'components/create_post.jsx';
import PropTypes from 'prop-types';
import React from 'react';
@@ -87,9 +87,13 @@ export default class CreateComment extends React.Component {
if (this.state.message === '') {
this.setState({message: ':' + emojiAlias + ': '});
} else {
//check whether there is already a blank at the end of the current message
const newMessage = (/\s+$/.test(this.state.message)) ?
this.state.message + ':' + emojiAlias + ': ' : this.state.message + ' :' + emojiAlias + ': ';
// Check whether there is already a blank at the end of the current message
let newMessage;
if ((/\s+$/).test(this.state.message)) {
newMessage = this.state.message + ':' + emojiAlias + ': ';
} else {
newMessage = this.state.message + ' :' + emojiAlias + ': ';
}
this.setState({message: newMessage});
}
@@ -230,14 +234,6 @@ export default class CreateComment extends React.Component {
GlobalActions.emitUserCommentedEvent(post);
const emojiResult = post.message.match(EMOJI_PATTERN);
if (emojiResult) {
// parse message and emit emoji event
emojiResult.forEach((emoji) => {
PostActions.emitEmojiPosted(emoji);
});
}
PostActions.createPost(post, this.state.fileInfos);
this.setState({