Peers: Fix properties not resetting (#5331)

This commit is contained in:
zubiden 2024-12-20 11:37:27 +01:00 committed by Alexander Zinchuk
parent b8a906ef2f
commit 724f50bb59
3 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import type {
ApiTopic, ApiTopic,
} from '../../types'; } from '../../types';
import { omitUndefined, pick, pickTruthy } from '../../../util/iteratees'; import { pick, pickTruthy } from '../../../util/iteratees';
import { getServerTime, getServerTimeOffset } from '../../../util/serverTime'; import { getServerTime, getServerTimeOffset } from '../../../util/serverTime';
import { addPhotoToLocalDb, addUserToLocalDb, serializeBytes } from '../helpers'; import { addPhotoToLocalDb, addUserToLocalDb, serializeBytes } from '../helpers';
import { buildApiPhoto, buildApiUsernames, buildAvatarPhotoId } from './common'; import { buildApiPhoto, buildApiUsernames, buildAvatarPhotoId } from './common';
@ -71,7 +71,7 @@ function buildApiChatFieldsFromPeerEntity(
const areProfilesShown = Boolean('signatureProfiles' in peerEntity && peerEntity.signatureProfiles); const areProfilesShown = Boolean('signatureProfiles' in peerEntity && peerEntity.signatureProfiles);
const subscriptionUntil = 'subscriptionUntilDate' in peerEntity ? peerEntity.subscriptionUntilDate : undefined; const subscriptionUntil = 'subscriptionUntilDate' in peerEntity ? peerEntity.subscriptionUntilDate : undefined;
return omitUndefined<PeerEntityApiChatFields>({ return {
isMin, isMin,
hasPrivateLink, hasPrivateLink,
areSignaturesShown, areSignaturesShown,
@ -104,7 +104,7 @@ function buildApiChatFieldsFromPeerEntity(
emojiStatus, emojiStatus,
boostLevel, boostLevel,
subscriptionUntil, subscriptionUntil,
}); };
} }
export function buildApiChatFromDialog( export function buildApiChatFromDialog(

View File

@ -6,7 +6,7 @@ import type { ChatListType, GlobalState } from '../types';
import { ARCHIVED_FOLDER_ID } from '../../config'; import { ARCHIVED_FOLDER_ID } from '../../config';
import { areDeepEqual } from '../../util/areDeepEqual'; import { areDeepEqual } from '../../util/areDeepEqual';
import { import {
areSortedArraysEqual, buildCollectionByKey, omit, pick, unique, areSortedArraysEqual, buildCollectionByKey, omit, omitUndefined, pick, unique,
} from '../../util/iteratees'; } from '../../util/iteratees';
import { selectChatFullInfo } from '../selectors'; import { selectChatFullInfo } from '../selectors';
@ -310,7 +310,7 @@ function getUpdatedChat<T extends GlobalState>(
return undefined; return undefined;
} }
return updatedChat; return omitUndefined(updatedChat);
} }
export function updateChatListType<T extends GlobalState>( export function updateChatListType<T extends GlobalState>(

View File

@ -5,7 +5,7 @@ import type { GlobalState, TabArgs, TabState } from '../types';
import { areDeepEqual } from '../../util/areDeepEqual'; import { areDeepEqual } from '../../util/areDeepEqual';
import { getCurrentTabId } from '../../util/establishMultitabRole'; import { getCurrentTabId } from '../../util/establishMultitabRole';
import { omit, unique } from '../../util/iteratees'; import { omit, omitUndefined, unique } from '../../util/iteratees';
import { MEMO_EMPTY_ARRAY } from '../../util/memo'; import { MEMO_EMPTY_ARRAY } from '../../util/memo';
import { selectTabState } from '../selectors'; import { selectTabState } from '../selectors';
import { updateChat } from './chats'; import { updateChat } from './chats';
@ -140,7 +140,7 @@ function getUpdatedUser(global: GlobalState, userId: string, userUpdate: Partial
return undefined; return undefined;
} }
return updatedUser; return omitUndefined(updatedUser);
} }
export function deleteContact<T extends GlobalState>(global: T, userId: string): T { export function deleteContact<T extends GlobalState>(global: T, userId: string): T {