blob: e5c9751c0db5a3aba360e1e5ce8796ab1e8fdeb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import UserStore from 'stores/user_store.jsx';
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) {
getAllCustomEmojis(10000)(dispatch, getState).then(
(data) => {
if (getProfiles) {
loadProfilesForEmoji(data);
}
}
);
}
function loadProfilesForEmoji(emojiList) {
const profilesToLoad = {};
for (let i = 0; i < emojiList.length; i++) {
const emoji = emojiList[i];
if (!UserStore.hasProfile(emoji.creator_id)) {
profilesToLoad[emoji.creator_id] = true;
}
}
const list = Object.keys(profilesToLoad);
if (list.length === 0) {
return;
}
getProfilesByIds(list)(dispatch, getState);
}
|