From 557113e17104f02002b57b5ea54e831beaa89bcd Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Fri, 20 Mar 2026 12:13:21 -0500 Subject: [PATCH] Ignore expireTimerVersion=0 messages Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> --- ts/models/conversations.preload.ts | 53 ++++++++++++++++++++---------- ts/services/contactSync.preload.ts | 2 +- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ts/models/conversations.preload.ts b/ts/models/conversations.preload.ts index 21738ea045..03bd1eaf51 100644 --- a/ts/models/conversations.preload.ts +++ b/ts/models/conversations.preload.ts @@ -4811,12 +4811,28 @@ export class ConversationModel { reason: string; receivedAt?: number; receivedAtMS?: number; - sentAt?: number; - source?: string; - version: number | undefined; fromSync?: boolean; isInitialSync?: boolean; - } + } & ( + | { + // isSetByOther=true + sentAt: number; + source?: string; + version: number; + } + | { + // isSetByOther=true + sentAt?: number; + source: string; + version: number; + } + | { + // isSetByOther=false + sentAt?: undefined; + source?: undefined; + version: undefined; + } + ) ): Promise { const isSetByOther = providedSource || providedSentAt !== undefined; @@ -4882,21 +4898,24 @@ export class ConversationModel { `source=${source ?? '?'} localValue=${this.get('expireTimer')} ` + `localVersion=${localVersion}, reason=${reason}, isInitialSync=${isInitialSync}`; - if (isSetByOther) { - if (version) { - if (localVersion && version < localVersion) { - log.warn(`${logId}: not updating, local version is ${localVersion}`); - return; - } + if (version === 0) { + log.warn(`${logId}: not updating, zero version`); + return; + } - if (version === localVersion) { - if (!timerMatchesLocalValue) { - log.warn(`${logId}: expire version glare`); - } - } else { - this.set({ expireTimerVersion: version }); - log.info(`${logId}: updating expire version`); + if (isSetByOther) { + if (localVersion && version < localVersion) { + log.warn(`${logId}: not updating, local version is ${localVersion}`); + return; + } + + if (version === localVersion) { + if (!timerMatchesLocalValue) { + log.warn(`${logId}: expire version glare`); } + } else { + this.set({ expireTimerVersion: version }); + log.info(`${logId}: updating expire version`); } } diff --git a/ts/services/contactSync.preload.ts b/ts/services/contactSync.preload.ts index a13a6299ed..f055dc0bf2 100644 --- a/ts/services/contactSync.preload.ts +++ b/ts/services/contactSync.preload.ts @@ -88,7 +88,7 @@ async function updateConversationFromContactSync( await conversation.updateExpirationTimer(details.expireTimer, { // Note: because it's our conversationId, this notification will be marked read. But // setting this will make 'isSetByOther' check true. - source: window.ConversationController.getOurConversationId(), + source: window.ConversationController.getOurConversationIdOrThrow(), receivedAt: receivedAtCounter, version: details.expireTimerVersion ?? 1, fromSync: true,