[MM-61958] Always fetch team unreads for current team on reconnect (#29529)

Этот коммит содержится в:
Devin Binnie
2024-12-12 12:49:13 -05:00
коммит произвёл GitHub
родитель a5a92d825a
Коммит c19e0ea0e7
2 изменённых файлов: 2 добавлений и 15 удалений

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

@@ -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);

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

@@ -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,