PLT-6885/PLT-6888 Fix custom emojis (#6694)
* Fix custom emojis * Fix custom emoji reactions
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2e6fd031d1
Коммит
414b208100
@@ -1,35 +1,20 @@
|
|||||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
|
|
||||||
|
|
||||||
import UserStore from 'stores/user_store.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';
|
import store from 'stores/redux_store.jsx';
|
||||||
const dispatch = store.dispatch;
|
const dispatch = store.dispatch;
|
||||||
const getState = store.getState;
|
const getState = store.getState;
|
||||||
import {getProfilesByIds} from 'mattermost-redux/actions/users';
|
import {getProfilesByIds} from 'mattermost-redux/actions/users';
|
||||||
|
import {getAllCustomEmojis} from 'mattermost-redux/actions/emojis';
|
||||||
|
|
||||||
export function loadEmoji(getProfiles = true) {
|
export function loadEmoji(getProfiles = true) {
|
||||||
Client.listEmoji(
|
getAllCustomEmojis(10000)(dispatch, getState).then(
|
||||||
(data) => {
|
(data) => {
|
||||||
AppDispatcher.handleServerAction({
|
|
||||||
type: ActionTypes.RECEIVED_CUSTOM_EMOJIS,
|
|
||||||
emojis: data
|
|
||||||
});
|
|
||||||
|
|
||||||
if (getProfiles) {
|
if (getProfiles) {
|
||||||
loadProfilesForEmoji(data);
|
loadProfilesForEmoji(data);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
AsyncClient.dispatchError(err, 'listEmoji');
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import {connect} from 'react-redux';
|
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 {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUserMentionKeys, getUsersByUsername} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserMentionKeys, getUsersByUsername} from 'mattermost-redux/selectors/entities/users';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ function makeMapStateToProps() {
|
|||||||
let oldCustomEmoji;
|
let oldCustomEmoji;
|
||||||
|
|
||||||
return function mapStateToProps(state, ownProps) {
|
return function mapStateToProps(state, ownProps) {
|
||||||
const newCustomEmoji = getCustomEmojisAsMap(state);
|
const newCustomEmoji = getCustomEmojisByName(state);
|
||||||
if (newCustomEmoji !== oldCustomEmoji) {
|
if (newCustomEmoji !== oldCustomEmoji) {
|
||||||
emojiMap = new EmojiMap(newCustomEmoji);
|
emojiMap = new EmojiMap(newCustomEmoji);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function makeMapStateToProps() {
|
|||||||
if (Emoji.EmojiIndicesByAlias.has(ownProps.emojiName)) {
|
if (Emoji.EmojiIndicesByAlias.has(ownProps.emojiName)) {
|
||||||
emoji = Emoji.Emojis[Emoji.EmojiIndicesByAlias.get(ownProps.emojiName)];
|
emoji = Emoji.Emojis[Emoji.EmojiIndicesByAlias.get(ownProps.emojiName)];
|
||||||
} else {
|
} else {
|
||||||
emoji = ownProps.emojis[ownProps.emojiName];
|
emoji = ownProps.emojis.get(ownProps.emojiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import {makeGetReactionsForPost} from 'mattermost-redux/selectors/entities/posts';
|
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';
|
import * as Actions from 'mattermost-redux/actions/posts';
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function makeMapStateToProps() {
|
|||||||
return {
|
return {
|
||||||
...ownProps,
|
...ownProps,
|
||||||
reactions: getReactionsForPost(state, ownProps.post.id),
|
reactions: getReactionsForPost(state, ownProps.post.id),
|
||||||
emojis: getCustomEmojisAsMap(state)
|
emojis: getCustomEmojisByName(state)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user