Remove participant is typing as soon as the post arrives

parent 9cfcacb3
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {batchActions} from 'redux-batched-actions';
import {PostTypes} from 'mattermost-redux/action_types';
import {
markChannelAsRead,
......@@ -8,6 +9,7 @@ import {
markChannelAsViewed,
} from 'mattermost-redux/actions/channels';
import * as PostActions from 'mattermost-redux/actions/posts';
import {WebsocketEvents} from 'mattermost-redux/constants';
import * as PostSelectors from 'mattermost-redux/selectors/entities/posts';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
......@@ -52,7 +54,7 @@ export function lastPostActions(post, websocketMessageProps) {
}
// Need manual dispatch to remove pending post
dispatch({
const actions = [{
type: PostTypes.RECEIVED_POSTS,
data: {
order: [],
......@@ -61,7 +63,16 @@ export function lastPostActions(post, websocketMessageProps) {
},
},
channelId: post.channel_id,
});
}, {
type: WebsocketEvents.STOP_TYPING,
data: {
id: post.channel_id + post.root_id,
userId: post.user_id,
now: Date.now(),
},
}];
dispatch(batchActions(actions));
// Still needed to update unreads
......
......@@ -773,7 +773,7 @@ function handleUserTypingEvent(msg) {
dispatch({
type: WebsocketEvents.STOP_TYPING,
data,
}, getState);
});
}, parseInt(config.TimeBetweenUserTypingUpdatesMilliseconds, 10));
if (!currentUser && userId !== currentUserId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment