This reverts commit 250a344d04.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
250a344d04
Коммит
4956a7198b
@@ -19,6 +19,7 @@ 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 * as PostActions from 'mattermost-redux/actions/posts';
|
import * as PostActions from 'mattermost-redux/actions/posts';
|
||||||
import {getMyChannelMember} from 'mattermost-redux/actions/channels';
|
import {getMyChannelMember} from 'mattermost-redux/actions/channels';
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ function completePostReceive(post, websocketMessageProps) {
|
|||||||
PostActions.getPostThread(post.root_id)(dispatch, getState).then(
|
PostActions.getPostThread(post.root_id)(dispatch, getState).then(
|
||||||
(data) => {
|
(data) => {
|
||||||
dispatchPostActions(post, websocketMessageProps);
|
dispatchPostActions(post, websocketMessageProps);
|
||||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
loadProfilesForPosts(data.posts);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ export function getFlaggedPosts() {
|
|||||||
is_pinned_posts: false
|
is_pinned_posts: false
|
||||||
});
|
});
|
||||||
|
|
||||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
loadProfilesForPosts(data.posts);
|
||||||
}
|
}
|
||||||
).catch(
|
).catch(
|
||||||
() => {} //eslint-disable-line no-empty-function
|
() => {} //eslint-disable-line no-empty-function
|
||||||
@@ -146,13 +147,34 @@ export function getPinnedPosts(channelId = ChannelStore.getCurrentId()) {
|
|||||||
is_pinned_posts: true
|
is_pinned_posts: true
|
||||||
});
|
});
|
||||||
|
|
||||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
loadProfilesForPosts(data.posts);
|
||||||
}
|
}
|
||||||
).catch(
|
).catch(
|
||||||
() => {} //eslint-disable-line no-empty-function
|
() => {} //eslint-disable-line no-empty-function
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loadProfilesForPosts(posts) {
|
||||||
|
const profilesToLoad = {};
|
||||||
|
for (const pid in posts) {
|
||||||
|
if (!posts.hasOwnProperty(pid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const post = posts[pid];
|
||||||
|
if (!UserStore.hasProfile(post.user_id)) {
|
||||||
|
profilesToLoad[post.user_id] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = Object.keys(profilesToLoad);
|
||||||
|
if (list.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProfilesByIds(list)(dispatch, getState);
|
||||||
|
}
|
||||||
|
|
||||||
export function addReaction(channelId, postId, emojiName) {
|
export function addReaction(channelId, postId, emojiName) {
|
||||||
PostActions.addReaction(postId, emojiName)(dispatch, getState);
|
PostActions.addReaction(postId, emojiName)(dispatch, getState);
|
||||||
}
|
}
|
||||||
@@ -230,7 +252,7 @@ export function performSearch(terms, isMentionSearch, success, error) {
|
|||||||
is_mention_search: isMentionSearch
|
is_mention_search: isMentionSearch
|
||||||
});
|
});
|
||||||
|
|
||||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
loadProfilesForPosts(data.posts);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
success(data);
|
success(data);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import WebSocketClient from 'client/web_websocket_client.jsx';
|
|||||||
import * as WebrtcActions from './webrtc_actions.jsx';
|
import * as WebrtcActions from './webrtc_actions.jsx';
|
||||||
|
|
||||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||||
import {handleNewPost} from 'actions/post_actions.jsx';
|
import {handleNewPost, loadProfilesForPosts} from 'actions/post_actions.jsx';
|
||||||
import {loadProfilesForSidebar} from 'actions/user_actions.jsx';
|
import {loadProfilesForSidebar} from 'actions/user_actions.jsx';
|
||||||
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||||
import * as StatusActions from 'actions/status_actions.jsx';
|
import * as StatusActions from 'actions/status_actions.jsx';
|
||||||
@@ -34,7 +34,7 @@ import {getSiteURL} from 'utils/url.jsx';
|
|||||||
|
|
||||||
import * as TeamActions from 'mattermost-redux/actions/teams';
|
import * as TeamActions from 'mattermost-redux/actions/teams';
|
||||||
import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels';
|
import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels';
|
||||||
import {getPosts, getProfilesAndStatusesForPosts} from 'mattermost-redux/actions/posts';
|
import {getPosts} from 'mattermost-redux/actions/posts';
|
||||||
import {setServerVersion} from 'mattermost-redux/actions/general';
|
import {setServerVersion} from 'mattermost-redux/actions/general';
|
||||||
import {ChannelTypes, TeamTypes, UserTypes, PostTypes, EmojiTypes} from 'mattermost-redux/action_types';
|
import {ChannelTypes, TeamTypes, UserTypes, PostTypes, EmojiTypes} from 'mattermost-redux/action_types';
|
||||||
|
|
||||||
@@ -242,7 +242,9 @@ function handleNewPostEvent(msg) {
|
|||||||
const post = JSON.parse(msg.data.post);
|
const post = JSON.parse(msg.data.post);
|
||||||
handleNewPost(post, msg);
|
handleNewPost(post, msg);
|
||||||
|
|
||||||
getProfilesAndStatusesForPosts([post], dispatch, getState);
|
const posts = {};
|
||||||
|
posts[post.id] = post;
|
||||||
|
loadProfilesForPosts(posts);
|
||||||
|
|
||||||
if (post.user_id !== UserStore.getCurrentId()) {
|
if (post.user_id !== UserStore.getCurrentId()) {
|
||||||
UserStore.setStatus(post.user_id, UserStatuses.ONLINE);
|
UserStore.setStatus(post.user_id, UserStatuses.ONLINE);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user