[MM-58070] Ensure the batched post handler also send websocket acknowledgements (#26938)

* [MM-58070] Ensure the batched post handler also send websocket acknowledgements

* Add ack for missing root post error

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2024-05-01 10:44:09 -04:00
коммит произвёл GitHub
родитель 3bd6c44413
Коммит 4db2ae5753
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@@ -49,6 +49,9 @@ export function completePostReceive(post: Post, websocketMessageProps: NewPostMe
const result = await dispatch(PostActions.getPostThread(post.root_id));
if ('error' in result) {
if (websocketMessageProps.should_ack) {
WebSocketClient.acknowledgePostedNotification(post.id, 'error', 'missing_root_post', result.error);
}
return {error: result.error};
}
}

Просмотреть файл

@@ -733,6 +733,12 @@ export function handleNewPostEvents(queue) {
console.log('handleNewPostEvents - new posts received', posts);
}
posts.forEach((post, index) => {
if (queue[index].data.should_ack) {
WebSocketClient.acknowledgePostedNotification(post.id, 'not_sent', 'too_many_posts');
}
});
// Receive the posts as one continuous block since they were received within a short period
const crtEnabled = isCollapsedThreadsEnabled(myGetState());
const actions = posts.map((post) => receivedNewPost(post, crtEnabled));