Contact Sync: Only update expireTimer on first sync
This commit is contained in:
parent
f1a7ac8c3d
commit
3a28aaab53
1 changed files with 19 additions and 10 deletions
|
@ -31,6 +31,7 @@ async function updateConversationFromContactSync(
|
||||||
receivedAtCounter: number,
|
receivedAtCounter: number,
|
||||||
sentAt: number
|
sentAt: number
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const logId = `updateConversationFromContactSync(${conversation.idForLogging()}`;
|
||||||
const { writeNewAttachmentData, deleteAttachmentData, doesAttachmentExist } =
|
const { writeNewAttachmentData, deleteAttachmentData, doesAttachmentExist } =
|
||||||
window.Signal.Migrations;
|
window.Signal.Migrations;
|
||||||
|
|
||||||
|
@ -60,16 +61,24 @@ async function updateConversationFromContactSync(
|
||||||
conversation.set({ avatar: null });
|
conversation.set({ avatar: null });
|
||||||
}
|
}
|
||||||
|
|
||||||
// expireTimer isn't in Storage Service so we have to rely on contact sync.
|
if (isInitialSync) {
|
||||||
await conversation.updateExpirationTimer(details.expireTimer, {
|
// expireTimer isn't in Storage Service so we have to rely on contact sync.
|
||||||
// Note: because it's our conversationId, this notification will be marked read. But
|
await conversation.updateExpirationTimer(details.expireTimer, {
|
||||||
// setting this will make 'isSetByOther' check true.
|
// Note: because it's our conversationId, this notification will be marked read. But
|
||||||
source: window.ConversationController.getOurConversationId(),
|
// setting this will make 'isSetByOther' check true.
|
||||||
receivedAt: receivedAtCounter,
|
source: window.ConversationController.getOurConversationId(),
|
||||||
fromSync: true,
|
receivedAt: receivedAtCounter,
|
||||||
isInitialSync,
|
fromSync: true,
|
||||||
reason: `contact sync (sent=${sentAt})`,
|
isInitialSync,
|
||||||
});
|
reason: `contact sync (sent=${sentAt})`,
|
||||||
|
});
|
||||||
|
} else if (
|
||||||
|
(details.expireTimer ?? 0) !== (conversation.get('expireTimer') ?? 0)
|
||||||
|
) {
|
||||||
|
log.warn(
|
||||||
|
`${logId}: Expire timer from contact sync is different from our data, but isInitialSync=${isInitialSync} so we won't apply it.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
window.Whisper.events.trigger('incrementProgress');
|
window.Whisper.events.trigger('incrementProgress');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue