mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Increase post visibility in current channel when receiving posts (#6848)
This commit is contained in:
@@ -54,26 +54,7 @@ function completePostReceive(post, websocketMessageProps) {
|
||||
if (post.root_id && Selectors.getPost(getState(), post.root_id) == null) {
|
||||
PostActions.getPostThread(post.root_id)(dispatch, getState).then(
|
||||
(data) => {
|
||||
// Need manual dispatch to remove pending post
|
||||
dispatch({
|
||||
type: PostTypes.RECEIVED_POSTS,
|
||||
data: {
|
||||
order: [],
|
||||
posts: {
|
||||
[post.id]: post
|
||||
}
|
||||
},
|
||||
channelId: post.channel_id
|
||||
});
|
||||
|
||||
// Still needed to update unreads
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST,
|
||||
post,
|
||||
websocketMessageProps
|
||||
});
|
||||
|
||||
sendDesktopNotification(post, websocketMessageProps);
|
||||
dispatchPostActions(post, websocketMessageProps);
|
||||
loadProfilesForPosts(data.posts);
|
||||
}
|
||||
);
|
||||
@@ -81,6 +62,21 @@ function completePostReceive(post, websocketMessageProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatchPostActions(post, websocketMessageProps);
|
||||
}
|
||||
|
||||
function dispatchPostActions(post, websocketMessageProps) {
|
||||
const {currentChannelId} = getState().entities.channels;
|
||||
|
||||
if (post.channel_id === currentChannelId) {
|
||||
dispatch({
|
||||
type: ActionTypes.INCREASE_POST_VISIBILITY,
|
||||
data: post.channel_id,
|
||||
amount: 1
|
||||
});
|
||||
}
|
||||
|
||||
// Need manual dispatch to remove pending post
|
||||
dispatch({
|
||||
type: PostTypes.RECEIVED_POSTS,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user