mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Ignore expireTimerVersion=0 messages
This commit is contained in:
@@ -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`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user