Improve "send anyway" experience when starting app

This commit is contained in:
Evan Hahn 2022-01-04 16:24:18 -06:00 committed by GitHub
parent 54e252ecc2
commit 2f90608e1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 21 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import type PQueue from 'p-queue'; import type PQueue from 'p-queue';
@ -156,6 +156,7 @@ export class NormalMessageSendJobQueue extends JobQueue<NormalMessageSendJobData
messageId, messageId,
untrustedConversationIds untrustedConversationIds
); );
await markMessageFailed(message, messageSendErrors);
return; return;
} }

View file

@ -1,4 +1,4 @@
// Copyright 2020-2021 Signal Messenger, LLC // Copyright 2020-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable camelcase */ /* eslint-disable camelcase */
@ -2513,10 +2513,10 @@ export class ConversationModel extends window.Backbone
); );
} }
async _setVerified( private async _setVerified(
verified: number, verified: number,
providedOptions?: VerificationOptions providedOptions?: VerificationOptions
): Promise<boolean | void> { ): Promise<void> {
const options = providedOptions || {}; const options = providedOptions || {};
window._.defaults(options, { window._.defaults(options, {
viaStorageServiceSync: false, viaStorageServiceSync: false,
@ -2537,7 +2537,7 @@ export class ConversationModel extends window.Backbone
const uuid = this.getUuid(); const uuid = this.getUuid();
const beginningVerified = this.get('verified'); const beginningVerified = this.get('verified');
let keyChange; let keyChange = false;
if (options.viaSyncMessage) { if (options.viaSyncMessage) {
strictAssert( strictAssert(
uuid, uuid,
@ -2553,10 +2553,7 @@ export class ConversationModel extends window.Backbone
options.key || undefined options.key || undefined
); );
} else if (uuid) { } else if (uuid) {
keyChange = await window.textsecure.storage.protocol.setVerified( await window.textsecure.storage.protocol.setVerified(uuid, verified);
uuid,
verified
);
} else { } else {
log.warn(`_setVerified(${this.id}): no uuid to update protocol storage`); log.warn(`_setVerified(${this.id}): no uuid to update protocol storage`);
} }
@ -2572,17 +2569,21 @@ export class ConversationModel extends window.Backbone
this.captureChange('verified'); this.captureChange('verified');
} }
// Three situations result in a verification notice in the conversation: const didSomethingChange = keyChange || beginningVerified !== verified;
// 1) The message came from an explicit verification in another client (not const isExplicitUserAction =
// a contact sync) !options.viaContactSync && !options.viaStorageServiceSync;
// 2) The verification value received by the contact sync is different const shouldShowFromContactSync =
// from what we have on record (and it's not a transition to UNVERIFIED) options.viaContactSync && verified !== UNVERIFIED;
// 3) Our local verification status is VERIFIED and it hasn't changed,
// but the key did change (Key1/VERIFIED to Key2/VERIFIED - but we don't
// want to show DEFAULT->DEFAULT or UNVERIFIED->UNVERIFIED)
if ( if (
!options.viaContactSync || // The message came from an explicit verification in a client (not a contact sync
(beginningVerified !== verified && verified !== UNVERIFIED) || // or storage service sync)
(didSomethingChange && isExplicitUserAction) ||
// The verification value received by the contact sync is different from what we
// have on record (and it's not a transition to UNVERIFIED)
(didSomethingChange && shouldShowFromContactSync) ||
// Our local verification status is VERIFIED and it hasn't changed, but the key did
// change (Key1/VERIFIED -> Key2/VERIFIED), but we don't want to show DEFAULT ->
// DEFAULT or UNVERIFIED -> UNVERIFIED
(keyChange && verified === VERIFIED) (keyChange && verified === VERIFIED)
) { ) {
await this.addVerifiedChange(this.id, verified === VERIFIED, { await this.addVerifiedChange(this.id, verified === VERIFIED, {
@ -2592,8 +2593,6 @@ export class ConversationModel extends window.Backbone
if (!options.viaSyncMessage && uuid) { if (!options.viaSyncMessage && uuid) {
await this.sendVerifySyncMessage(this.get('e164'), uuid, verified); await this.sendVerifySyncMessage(this.get('e164'), uuid, verified);
} }
return keyChange;
} }
async sendVerifySyncMessage( async sendVerifySyncMessage(