mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 00:07:56 +01:00
Ignore expireTimerVersion=0 messages
This commit is contained in:
@@ -4811,12 +4811,28 @@ export class ConversationModel {
|
|||||||
reason: string;
|
reason: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
receivedAtMS?: number;
|
receivedAtMS?: number;
|
||||||
sentAt?: number;
|
|
||||||
source?: string;
|
|
||||||
version: number | undefined;
|
|
||||||
fromSync?: boolean;
|
fromSync?: boolean;
|
||||||
isInitialSync?: 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> {
|
): Promise<void> {
|
||||||
const isSetByOther = providedSource || providedSentAt !== undefined;
|
const isSetByOther = providedSource || providedSentAt !== undefined;
|
||||||
|
|
||||||
@@ -4882,21 +4898,24 @@ export class ConversationModel {
|
|||||||
`source=${source ?? '?'} localValue=${this.get('expireTimer')} ` +
|
`source=${source ?? '?'} localValue=${this.get('expireTimer')} ` +
|
||||||
`localVersion=${localVersion}, reason=${reason}, isInitialSync=${isInitialSync}`;
|
`localVersion=${localVersion}, reason=${reason}, isInitialSync=${isInitialSync}`;
|
||||||
|
|
||||||
if (isSetByOther) {
|
if (version === 0) {
|
||||||
if (version) {
|
log.warn(`${logId}: not updating, zero version`);
|
||||||
if (localVersion && version < localVersion) {
|
return;
|
||||||
log.warn(`${logId}: not updating, local version is ${localVersion}`);
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version === localVersion) {
|
if (isSetByOther) {
|
||||||
if (!timerMatchesLocalValue) {
|
if (localVersion && version < localVersion) {
|
||||||
log.warn(`${logId}: expire version glare`);
|
log.warn(`${logId}: not updating, local version is ${localVersion}`);
|
||||||
}
|
return;
|
||||||
} else {
|
}
|
||||||
this.set({ expireTimerVersion: version });
|
|
||||||
log.info(`${logId}: updating expire version`);
|
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, {
|
await conversation.updateExpirationTimer(details.expireTimer, {
|
||||||
// Note: because it's our conversationId, this notification will be marked read. But
|
// Note: because it's our conversationId, this notification will be marked read. But
|
||||||
// setting this will make 'isSetByOther' check true.
|
// setting this will make 'isSetByOther' check true.
|
||||||
source: window.ConversationController.getOurConversationId(),
|
source: window.ConversationController.getOurConversationIdOrThrow(),
|
||||||
receivedAt: receivedAtCounter,
|
receivedAt: receivedAtCounter,
|
||||||
version: details.expireTimerVersion ?? 1,
|
version: details.expireTimerVersion ?? 1,
|
||||||
fromSync: true,
|
fromSync: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user