Fix condition in getE164

This commit is contained in:
Fedor Indutny
2024-02-07 13:31:55 -08:00
committed by GitHub
parent 248cddcc5f
commit 910d652c4d
3 changed files with 10 additions and 9 deletions

View File

@@ -247,12 +247,6 @@ export function createIPCEvents(
setPhoneNumberSharingSetting: async (newValue: PhoneNumberSharingMode) => {
const account = window.ConversationController.getOurConversationOrThrow();
// writeProfile fetches the latest profile first so do it before updating
// local data to prevent triggering a conflict.
await writeProfile(getConversation(account), {
keepAvatar: true,
});
const promises = new Array<Promise<void>>();
promises.push(window.storage.put('phoneNumberSharingMode', newValue));
if (newValue === PhoneNumberSharingMode.Everybody) {
@@ -264,6 +258,12 @@ export function createIPCEvents(
}
account.captureChange('phoneNumberSharingMode');
await Promise.all(promises);
// Write profile after updating storage so that the write has up-to-date
// information.
await writeProfile(getConversation(account), {
keepAvatar: true,
});
},
getHasStoriesDisabled: () =>

View File

@@ -14,11 +14,12 @@ export function getE164(
| 'systemFamilyName'
| 'e164'
| 'notSharingPhoneNumber'
| 'profileKey'
>
): string | undefined {
const { e164, notSharingPhoneNumber = false } = attributes;
const { e164, profileKey, notSharingPhoneNumber = false } = attributes;
if (notSharingPhoneNumber && !isInSystemContacts(attributes)) {
if (notSharingPhoneNumber && profileKey && !isInSystemContacts(attributes)) {
return undefined;
}

View File

@@ -110,7 +110,7 @@ export function getSystemName(
export function getNumber(
attributes: Pick<
ConversationAttributesType,
'e164' | 'type' | 'notSharingPhoneNumber'
'e164' | 'type' | 'notSharingPhoneNumber' | 'profileKey'
>
): string | undefined {
if (!isDirectConversation(attributes)) {