diff --git a/src/global/reducers/chats.ts b/src/global/reducers/chats.ts index 505f097b7..def35cf03 100644 --- a/src/global/reducers/chats.ts +++ b/src/global/reducers/chats.ts @@ -1,6 +1,6 @@ import type { GlobalState } from '../types'; import type { - ApiChat, ApiChatMember, ApiTopic, ApiPhoto, ApiChatFullInfo, + ApiChat, ApiChatFullInfo, ApiChatMember, ApiPhoto, ApiTopic, } from '../../api/types'; import { ARCHIVED_FOLDER_ID } from '../../config'; @@ -142,11 +142,13 @@ export function addChats(global: T, newById: Record>((acc, id) => { const existingChat = byId[id]; - if (existingChat && !existingChat.isMin) { + const newChat = newById[id]; + + if (existingChat && !existingChat.isMin && (newChat.isMin || existingChat.accessHash === newChat.accessHash)) { return acc; } - const updatedChat = getUpdatedChat(global, id, newById[id]); + const updatedChat = getUpdatedChat(global, id, newChat); if (updatedChat) { acc[id] = updatedChat; if (!isUpdated) { diff --git a/src/global/reducers/users.ts b/src/global/reducers/users.ts index 686032de6..555b919e1 100644 --- a/src/global/reducers/users.ts +++ b/src/global/reducers/users.ts @@ -84,11 +84,13 @@ export function addUsers(global: T, newById: Record>((acc, id) => { const existingUser = byId[id]; - if (existingUser && !existingUser.isMin) { + const newUser = newById[id]; + + if (existingUser && !existingUser.isMin && (newUser.isMin || existingUser.accessHash === newUser.accessHash)) { return acc; } - const updatedUser = getUpdatedUser(global, id, newById[id]); + const updatedUser = getUpdatedUser(global, id, newUser); if (updatedUser) { acc[id] = updatedUser; if (!isUpdated) {