[MM-61958] Always fetch team unreads for current team on reconnect (#29529)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a5a92d825a
Коммит
c19e0ea0e7
@@ -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,
|
||||
|
||||
Ссылка в новой задаче
Block a user