Move setVerified to conversation queue
This commit is contained in:
parent
26ae1c8a88
commit
371c73377c
4 changed files with 16 additions and 7 deletions
|
@ -2662,8 +2662,10 @@ export class ConversationModel extends window.Backbone
|
||||||
await this.initialPromise;
|
await this.initialPromise;
|
||||||
const verified = await this.safeGetVerified();
|
const verified = await this.safeGetVerified();
|
||||||
|
|
||||||
if (this.get('verified') !== verified) {
|
const oldVerified = this.get('verified');
|
||||||
|
if (oldVerified !== verified) {
|
||||||
this.set({ verified });
|
this.set({ verified });
|
||||||
|
this.captureChange(`updateVerified from=${oldVerified} to=${verified}`);
|
||||||
window.Signal.Data.updateConversation(this.attributes);
|
window.Signal.Data.updateConversation(this.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2730,7 +2732,9 @@ export class ConversationModel extends window.Backbone
|
||||||
window.Signal.Data.updateConversation(this.attributes);
|
window.Signal.Data.updateConversation(this.attributes);
|
||||||
|
|
||||||
if (beginningVerified !== verified) {
|
if (beginningVerified !== verified) {
|
||||||
this.captureChange(`verified from=${beginningVerified} to=${verified}`);
|
this.captureChange(
|
||||||
|
`_setVerified from=${beginningVerified} to=${verified}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const didVerifiedChange = beginningVerified !== verified;
|
const didVerifiedChange = beginningVerified !== verified;
|
||||||
|
@ -2861,7 +2865,9 @@ export class ConversationModel extends window.Backbone
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.textsecure.storage.protocol.setApproval(uuid, true);
|
return this.queueJob('setApproved', async () => {
|
||||||
|
return window.textsecure.storage.protocol.setApproval(uuid, true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
safeIsUntrusted(timestampThreshold?: number): boolean {
|
safeIsUntrusted(timestampThreshold?: number): boolean {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
|
|
||||||
|
import type { LibSignalErrorBase } from '@signalapp/libsignal-client';
|
||||||
|
|
||||||
import { parseRetryAfter } from '../util/parseRetryAfter';
|
import { parseRetryAfter } from '../util/parseRetryAfter';
|
||||||
|
|
||||||
import type { CallbackResultType } from './Types.d';
|
import type { CallbackResultType } from './Types.d';
|
||||||
|
@ -76,12 +78,13 @@ export class OutgoingIdentityKeyError extends ReplayableError {
|
||||||
public readonly identifier: string;
|
public readonly identifier: string;
|
||||||
|
|
||||||
// Note: Data to resend message is no longer captured
|
// Note: Data to resend message is no longer captured
|
||||||
constructor(incomingIdentifier: string) {
|
constructor(incomingIdentifier: string, cause?: LibSignalErrorBase) {
|
||||||
const identifier = incomingIdentifier.split('.')[0];
|
const identifier = incomingIdentifier.split('.')[0];
|
||||||
|
|
||||||
super({
|
super({
|
||||||
name: 'OutgoingIdentityKeyError',
|
name: 'OutgoingIdentityKeyError',
|
||||||
message: `The identity of ${identifier} has changed.`,
|
message: `The identity of ${identifier} has changed.`,
|
||||||
|
cause,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
|
|
|
@ -627,7 +627,7 @@ export default class OutgoingMessage {
|
||||||
error instanceof LibSignalErrorBase &&
|
error instanceof LibSignalErrorBase &&
|
||||||
error.code === ErrorCode.UntrustedIdentity
|
error.code === ErrorCode.UntrustedIdentity
|
||||||
) {
|
) {
|
||||||
newError = new OutgoingIdentityKeyError(identifier);
|
newError = new OutgoingIdentityKeyError(identifier, error);
|
||||||
log.error(
|
log.error(
|
||||||
'Got "key changed" error from encrypt - no identityKey for application layer',
|
'Got "key changed" error from encrypt - no identityKey for application layer',
|
||||||
identifier,
|
identifier,
|
||||||
|
@ -736,7 +736,7 @@ export default class OutgoingMessage {
|
||||||
error instanceof LibSignalErrorBase &&
|
error instanceof LibSignalErrorBase &&
|
||||||
error.code === ErrorCode.UntrustedIdentity
|
error.code === ErrorCode.UntrustedIdentity
|
||||||
) {
|
) {
|
||||||
const newError = new OutgoingIdentityKeyError(identifier);
|
const newError = new OutgoingIdentityKeyError(identifier, error);
|
||||||
this.registerError(identifier, 'Untrusted identity', newError);
|
this.registerError(identifier, 'Untrusted identity', newError);
|
||||||
} else {
|
} else {
|
||||||
this.registerError(
|
this.registerError(
|
||||||
|
|
|
@ -167,7 +167,7 @@ async function handleServerKeys(
|
||||||
error instanceof LibSignalErrorBase &&
|
error instanceof LibSignalErrorBase &&
|
||||||
error.code === ErrorCode.UntrustedIdentity
|
error.code === ErrorCode.UntrustedIdentity
|
||||||
) {
|
) {
|
||||||
throw new OutgoingIdentityKeyError(identifier);
|
throw new OutgoingIdentityKeyError(identifier, error);
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue