From c19e0ea0e7b4fa2f93cca42c2b0deaf1683b1179 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:49:13 -0500 Subject: [PATCH] [MM-61958] Always fetch team unreads for current team on reconnect (#29529) --- webapp/channels/src/actions/websocket_actions.jsx | 2 +- .../mattermost-redux/src/actions/teams.ts | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/webapp/channels/src/actions/websocket_actions.jsx b/webapp/channels/src/actions/websocket_actions.jsx index b54586c5c7..75fd09509c 100644 --- a/webapp/channels/src/actions/websocket_actions.jsx +++ b/webapp/channels/src/actions/websocket_actions.jsx @@ -257,7 +257,7 @@ export function reconnect() { } const crtEnabled = isCollapsedThreadsEnabled(state); - dispatch(TeamActions.getMyTeamUnreads(crtEnabled, true)); + dispatch(TeamActions.getMyTeamUnreads(crtEnabled)); if (crtEnabled) { const teams = getMyTeams(state); syncThreads(currentTeamId, currentUserId); diff --git a/webapp/channels/src/packages/mattermost-redux/src/actions/teams.ts b/webapp/channels/src/packages/mattermost-redux/src/actions/teams.ts index 7a27660526..8d9dd6acd6 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/actions/teams.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/actions/teams.ts @@ -70,10 +70,7 @@ export function getMyTeams() { }); } -// The argument skipCurrentTeam is a (not ideal) workaround for CRT mention counts. Unread mentions are stored in the reducer per -// team but we do not track unread mentions for DMs/GMs independently. This results in a bit of funky logic and edge case bugs -// that need workarounds like this. In the future we should fix the root cause with better APIs and redux state. -export function getMyTeamUnreads(collapsedThreads: boolean, skipCurrentTeam = false): ActionFuncAsync { +export function getMyTeamUnreads(collapsedThreads: boolean): ActionFuncAsync { return async (dispatch, getState) => { let unreads; try { @@ -84,16 +81,6 @@ export function getMyTeamUnreads(collapsedThreads: boolean, skipCurrentTeam = fa return {error}; } - if (skipCurrentTeam) { - const currentTeamId = getCurrentTeamId(getState()); - if (currentTeamId) { - const index = unreads.findIndex((member) => member.team_id === currentTeamId); - if (index >= 0) { - unreads.splice(index, 1); - } - } - } - dispatch( { type: TeamTypes.RECEIVED_MY_TEAM_UNREADS,