Ignore expireTimerVersion=0 messages

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-03-20 12:13:21 -05:00
committed by GitHub
parent 96098fbb65
commit 557113e171
2 changed files with 37 additions and 18 deletions

View File

@@ -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<void> {
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`);
}
}

View File

@@ -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,