diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 65fb26265b9e..89453bf40e2c 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -1,11 +1,10 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { get, throttle } from 'lodash'; import { WebAPIType } from './textsecure/WebAPI'; export type ConfigKeyType = - | 'desktop.cds' | 'desktop.clientExpiration' | 'desktop.disableGV1' | 'desktop.groupCalling' diff --git a/ts/background.ts b/ts/background.ts index 3bb448952ac8..547fedd6c025 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -1755,40 +1755,38 @@ export async function startApp(): Promise { } try { - if (window.Signal.RemoteConfig.isEnabled('desktop.cds')) { - const lonelyE164s = window - .getConversations() - .filter(c => - Boolean( - c.isPrivate() && - c.get('e164') && - !c.get('uuid') && - !c.isEverUnregistered() - ) + const lonelyE164s = window + .getConversations() + .filter(c => + Boolean( + c.isPrivate() && + c.get('e164') && + !c.get('uuid') && + !c.isEverUnregistered() ) - .map(c => c.get('e164')) - .filter(Boolean) as Array; + ) + .map(c => c.get('e164')) + .filter(Boolean) as Array; - if (lonelyE164s.length > 0) { - const lookup = await window.textsecure.messaging.getUuidsForE164s( - lonelyE164s - ); - const e164s = Object.keys(lookup); - e164s.forEach(e164 => { - const uuid = lookup[e164]; - if (!uuid) { - const byE164 = window.ConversationController.get(e164); - if (byE164) { - byE164.setUnregistered(); - } + if (lonelyE164s.length > 0) { + const lookup = await window.textsecure.messaging.getUuidsForE164s( + lonelyE164s + ); + const e164s = Object.keys(lookup); + e164s.forEach(e164 => { + const uuid = lookup[e164]; + if (!uuid) { + const byE164 = window.ConversationController.get(e164); + if (byE164) { + byE164.setUnregistered(); } - window.ConversationController.ensureContactIds({ - e164, - uuid, - highTrust: true, - }); + } + window.ConversationController.ensureContactIds({ + e164, + uuid, + highTrust: true, }); - } + }); } } catch (error) { window.log.error( diff --git a/ts/textsecure/OutgoingMessage.ts b/ts/textsecure/OutgoingMessage.ts index c431cf8c1d52..ed3e1b98687a 100644 --- a/ts/textsecure/OutgoingMessage.ts +++ b/ts/textsecure/OutgoingMessage.ts @@ -23,7 +23,6 @@ import { } from 'libsignal-client'; import { ServerKeysType, WebAPIType } from './WebAPI'; -import { isEnabled as isRemoteFlagEnabled } from '../RemoteConfig'; import { ContentClass, DataMessageClass } from '../textsecure.d'; import { CallbackResultType, @@ -645,49 +644,47 @@ export default class OutgoingMessage { async sendToIdentifier(providedIdentifier: string): Promise { let identifier = providedIdentifier; try { - if (isRemoteFlagEnabled('desktop.cds')) { - if (window.isValidGuid(identifier)) { - // We're good! - } else if (isValidNumber(identifier)) { - if (!window.textsecure.messaging) { - throw new Error( - 'sendToIdentifier: window.textsecure.messaging is not available!' - ); - } - try { - const lookup = await window.textsecure.messaging.getUuidsForE164s([ - identifier, - ]); - const uuid = lookup[identifier]; - if (uuid) { - window.ConversationController.ensureContactIds({ - uuid, - e164: identifier, - highTrust: true, - }); - identifier = uuid; - } else { - const c = window.ConversationController.get(identifier); - if (c) { - c.setUnregistered(); - } - - throw new UnregisteredUserError( - identifier, - new Error('User is not registered') - ); - } - } catch (error) { - window.log.error( - `sentToIdentifier: Failed to fetch UUID for identifier ${identifier}`, - error && error.stack ? error.stack : error - ); - } - } else { + if (window.isValidGuid(identifier)) { + // We're good! + } else if (isValidNumber(identifier)) { + if (!window.textsecure.messaging) { throw new Error( - `sendToIdentifier: identifier ${identifier} was neither a UUID or E164` + 'sendToIdentifier: window.textsecure.messaging is not available!' ); } + try { + const lookup = await window.textsecure.messaging.getUuidsForE164s([ + identifier, + ]); + const uuid = lookup[identifier]; + if (uuid) { + window.ConversationController.ensureContactIds({ + uuid, + e164: identifier, + highTrust: true, + }); + identifier = uuid; + } else { + const c = window.ConversationController.get(identifier); + if (c) { + c.setUnregistered(); + } + + throw new UnregisteredUserError( + identifier, + new Error('User is not registered') + ); + } + } catch (error) { + window.log.error( + `sentToIdentifier: Failed to fetch UUID for identifier ${identifier}`, + error && error.stack ? error.stack : error + ); + } + } else { + throw new Error( + `sendToIdentifier: identifier ${identifier} was neither a UUID or E164` + ); } const updateDevices = await this.getStaleDeviceIdsForIdentifier(