Introduce desktop.pnp.storageService flag

This commit is contained in:
Fedor Indutny 2022-08-16 16:58:17 -07:00 committed by GitHub
parent 647335086d
commit 96c4cc4bcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View file

@ -16,6 +16,7 @@ export type ConfigKeyType =
| 'desktop.mediaQuality.levels'
| 'desktop.messageCleanup'
| 'desktop.messageRequests'
| 'desktop.pnp.storageService'
| 'desktop.retryReceiptLifespan'
| 'desktop.retryRespondMaxAge'
| 'desktop.senderKey.retry'

View file

@ -51,6 +51,7 @@ import type {
} from '../sql/Interface';
import dataInterface from '../sql/Client';
import { MY_STORIES_ID } from '../types/Stories';
import * as RemoteConfig from '../RemoteConfig';
const MY_STORIES_BYTES = uuidToBytes(MY_STORIES_ID);
@ -138,7 +139,7 @@ export async function toContactRecord(
contactRecord.serviceE164 = e164;
}
const pni = conversation.get('pni');
if (pni) {
if (pni && RemoteConfig.isEnabled('desktop.pnp.storageService')) {
contactRecord.pni = pni;
}
const profileKey = conversation.get('profileKey');
@ -851,9 +852,11 @@ export async function mergeContactRecord(
: undefined,
};
const isPniSupported = RemoteConfig.isEnabled('desktop.pnp.storageService');
const e164 = dropNull(contactRecord.serviceE164);
const uuid = dropNull(contactRecord.serviceUuid);
const pni = dropNull(contactRecord.pni);
const pni = isPniSupported ? dropNull(contactRecord.pni) : undefined;
// All contacts must have UUID
if (!uuid) {