summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-20 11:47:53 -0400
committerGitHub <noreply@github.com>2017-06-20 11:47:53 -0400
commit414b208100a36975d2fa238f4adfb33b20212122 (patch)
treec5821a854ed97d003808b2104781cf35ea48e498 /webapp
parent2e6fd031d15a9502e7a7a4536febfe49780c0697 (diff)
downloadchat-414b208100a36975d2fa238f4adfb33b20212122.tar.gz
chat-414b208100a36975d2fa238f4adfb33b20212122.tar.bz2
chat-414b208100a36975d2fa238f4adfb33b20212122.zip
PLT-6885/PLT-6888 Fix custom emojis (#6694)
* Fix custom emojis * Fix custom emoji reactions
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/emoji_actions.jsx19
-rw-r--r--webapp/components/post_view/post_message_view/index.js4
-rw-r--r--webapp/components/post_view/reaction/index.js2
-rw-r--r--webapp/components/post_view/reaction_list/index.js4
4 files changed, 7 insertions, 22 deletions
diff --git a/webapp/actions/emoji_actions.jsx b/webapp/actions/emoji_actions.jsx
index ed8bc84f7..e5c9751c0 100644
--- a/webapp/actions/emoji_actions.jsx
+++ b/webapp/actions/emoji_actions.jsx
@@ -1,35 +1,20 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
-
import UserStore from 'stores/user_store.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-import Client from 'client/web_client.jsx';
-
-import {ActionTypes} from 'utils/constants.jsx';
-
-// Redux actions
import store from 'stores/redux_store.jsx';
const dispatch = store.dispatch;
const getState = store.getState;
import {getProfilesByIds} from 'mattermost-redux/actions/users';
+import {getAllCustomEmojis} from 'mattermost-redux/actions/emojis';
export function loadEmoji(getProfiles = true) {
- Client.listEmoji(
+ getAllCustomEmojis(10000)(dispatch, getState).then(
(data) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_CUSTOM_EMOJIS,
- emojis: data
- });
-
if (getProfiles) {
loadProfilesForEmoji(data);
}
- },
- (err) => {
- AsyncClient.dispatchError(err, 'listEmoji');
}
);
}
diff --git a/webapp/components/post_view/post_message_view/index.js b/webapp/components/post_view/post_message_view/index.js
index cf457a508..84682eb89 100644
--- a/webapp/components/post_view/post_message_view/index.js
+++ b/webapp/components/post_view/post_message_view/index.js
@@ -2,7 +2,7 @@
// See License.txt for license information.
import {connect} from 'react-redux';
-import {getCustomEmojisAsMap} from 'mattermost-redux/selectors/entities/emojis';
+import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUserMentionKeys, getUsersByUsername} from 'mattermost-redux/selectors/entities/users';
@@ -20,7 +20,7 @@ function makeMapStateToProps() {
let oldCustomEmoji;
return function mapStateToProps(state, ownProps) {
- const newCustomEmoji = getCustomEmojisAsMap(state);
+ const newCustomEmoji = getCustomEmojisByName(state);
if (newCustomEmoji !== oldCustomEmoji) {
emojiMap = new EmojiMap(newCustomEmoji);
}
diff --git a/webapp/components/post_view/reaction/index.js b/webapp/components/post_view/reaction/index.js
index 9bb2524a1..b19e28f8d 100644
--- a/webapp/components/post_view/reaction/index.js
+++ b/webapp/components/post_view/reaction/index.js
@@ -20,7 +20,7 @@ function makeMapStateToProps() {
if (Emoji.EmojiIndicesByAlias.has(ownProps.emojiName)) {
emoji = Emoji.Emojis[Emoji.EmojiIndicesByAlias.get(ownProps.emojiName)];
} else {
- emoji = ownProps.emojis[ownProps.emojiName];
+ emoji = ownProps.emojis.get(ownProps.emojiName);
}
return {
diff --git a/webapp/components/post_view/reaction_list/index.js b/webapp/components/post_view/reaction_list/index.js
index 4fc9355d9..ee807ca88 100644
--- a/webapp/components/post_view/reaction_list/index.js
+++ b/webapp/components/post_view/reaction_list/index.js
@@ -4,7 +4,7 @@
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {makeGetReactionsForPost} from 'mattermost-redux/selectors/entities/posts';
-import {getCustomEmojisAsMap} from 'mattermost-redux/selectors/entities/emojis';
+import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
import * as Actions from 'mattermost-redux/actions/posts';
@@ -17,7 +17,7 @@ function makeMapStateToProps() {
return {
...ownProps,
reactions: getReactionsForPost(state, ownProps.post.id),
- emojis: getCustomEmojisAsMap(state)
+ emojis: getCustomEmojisByName(state)
};
};
}