fix: use updateExpireTimer for UserProfile

before we were setting the convo values directly
pull/2971/head
William Grant 2 years ago
parent 8ec6fb9fd7
commit f045562a33

@ -228,26 +228,26 @@ async function handleUserProfileUpdate(result: IncomingConfResult): Promise<Inco
const expireTimer = ourConvo.get('expireTimer'); const expireTimer = ourConvo.get('expireTimer');
const wrapperNoteToSelfExpirySeconds = await UserConfigWrapperActions.getNoteToSelfExpiry(); const wrapperNoteToSelfExpirySeconds = await UserConfigWrapperActions.getNoteToSelfExpiry();
// TODO Should use updateExpireTimer instead
if (wrapperNoteToSelfExpirySeconds !== expireTimer) { if (wrapperNoteToSelfExpirySeconds !== expireTimer) {
// we trust the wrapper more than the DB, so let's update the DB but we don't show it in the UI await ourConvo.updateExpireTimer({
ourConvo.set('expireTimer', wrapperNoteToSelfExpirySeconds); providedExpirationType:
wrapperNoteToSelfExpirySeconds && wrapperNoteToSelfExpirySeconds > 0
// NOTE Can only be 'off' or 'deleteAfterSend' so we don't need to check the expirationType we can just override it ? 'deleteAfterSend'
ourConvo.set( : 'off',
'expirationType', providedExpireTimer: wrapperNoteToSelfExpirySeconds,
wrapperNoteToSelfExpirySeconds && wrapperNoteToSelfExpirySeconds > 0 providedChangeTimestamp: result.latestEnvelopeTimestamp,
? 'deleteAfterSend' providedSource: ourConvo.id,
: 'off' receivedAt: result.latestEnvelopeTimestamp,
); fromSync: true,
shouldCommit: false,
});
changes = true; changes = true;
window.log.debug( window.log.debug(
`WIP: [userProfileWrapper] updating disappearing messages to`, `WIP: [userProfileWrapper] updating disappearing messages to expiratonMode: ${
wrapperNoteToSelfExpirySeconds && wrapperNoteToSelfExpirySeconds > 0 wrapperNoteToSelfExpirySeconds && wrapperNoteToSelfExpirySeconds > 0
? 'deleteAfterSend' ? 'deleteAfterSend'
: 'off', : 'off'
' ', } wrapperNoteToSelfExpirySeconds: ${wrapperNoteToSelfExpirySeconds}`
wrapperNoteToSelfExpirySeconds
); );
} }
@ -395,6 +395,9 @@ async function handleContactsUpdate(result: IncomingConfResult): Promise<Incomin
shouldCommit: false, shouldCommit: false,
}); });
changes = true; changes = true;
window.log.debug(
`WIP: [contactsWrapper] updating disappearing messages to expirationMode: ${wrapperConvo.expirationMode} expirationTimerSeconds: ${wrapperConvo.expirationTimerSeconds}`
);
} }
// we want to set the active_at to the created_at timestamp if active_at is unset, so that it shows up in our list. // we want to set the active_at to the created_at timestamp if active_at is unset, so that it shows up in our list.

Loading…
Cancel
Save