From d488f2f23d470252b4beea4580951cabd7ad7a2f Mon Sep 17 00:00:00 2001 From: "anton.buksa" Date: Wed, 3 Jul 2024 18:04:33 +0200 Subject: [PATCH 1/2] disable fetching channel own member on posted event Changelog: changed --- webapp/channels/src/actions/post_actions.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/webapp/channels/src/actions/post_actions.ts b/webapp/channels/src/actions/post_actions.ts index 5ebb8c5e47..0b1b296794 100644 --- a/webapp/channels/src/actions/post_actions.ts +++ b/webapp/channels/src/actions/post_actions.ts @@ -52,21 +52,22 @@ import type {NewPostMessageProps} from './new_post'; const ReactionLimitReachedModal = withSuspense(lazy(() => import('components/reaction_limit_reached_modal'))); export function handleNewPost(post: Post, msg?: {data?: NewPostMessageProps & GroupChannel}): ActionFuncAsync { - return async (dispatch, getState) => { + return async (dispatch) => { let websocketMessageProps = {}; - const state = getState(); + + // const state = getState(); if (msg) { websocketMessageProps = msg.data!; } - const myChannelMember = getMyChannelMemberSelector(state, post.channel_id); - const myChannelMemberDoesntExist = !myChannelMember || (Object.keys(myChannelMember).length === 0 && myChannelMember.constructor === Object); + // const myChannelMember = getMyChannelMemberSelector(state, post.channel_id); + // const myChannelMemberDoesntExist = !myChannelMember || (Object.keys(myChannelMember).length === 0 && myChannelMember.constructor === Object); - if (myChannelMemberDoesntExist) { - await dispatch(getMyChannelMember(post.channel_id)); - } + // if (myChannelMemberDoesntExist) { + // await dispatch(getMyChannelMember(post.channel_id)); + // } - dispatch(completePostReceive(post, websocketMessageProps as NewPostMessageProps, myChannelMemberDoesntExist)); + dispatch(completePostReceive(post, websocketMessageProps as NewPostMessageProps, false)); if (msg && msg.data) { if (msg.data.channel_type === Constants.DM_CHANNEL) { From a4ffc8459f2d149a81643f962ddd2a00cd756907 Mon Sep 17 00:00:00 2001 From: Ovgodd Date: Wed, 7 Aug 2024 11:27:58 +0200 Subject: [PATCH 2/2] add comment on why we could delete the commented code on post_actions --- webapp/channels/src/actions/post_actions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/channels/src/actions/post_actions.ts b/webapp/channels/src/actions/post_actions.ts index 0b1b296794..ff41f65f6e 100644 --- a/webapp/channels/src/actions/post_actions.ts +++ b/webapp/channels/src/actions/post_actions.ts @@ -55,6 +55,7 @@ export function handleNewPost(post: Post, msg?: {data?: NewPostMessageProps & Gr return async (dispatch) => { let websocketMessageProps = {}; + //!824 Infomaniak > The code is commented out below because it seems redundant with what loadNewDMIfNeeded and loadNewGMIfNeeded do, they already seem to integrate the necessary checks and updates to handle messaging channels and user preferences. // const state = getState(); if (msg) { websocketMessageProps = msg.data!;