updateSessionTimestamp: return false if no write to DB needed

pull/1172/head
Audric Ackermann 6 years ago
parent 205e7f59e7
commit 492cc96ad2
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1953,7 +1953,7 @@ MessageReceiver.prototype.extend({
let conversation; let conversation;
try { try {
conversation = window.ConversationController.get(number); conversation = window.ConversationController.get(number);
if(conversation) { if (conversation) {
await conversation.onSessionResetReceived(); await conversation.onSessionResetReceived();
} else { } else {
throw new Error(); throw new Error();

@ -220,17 +220,15 @@ export class SessionProtocol {
timestamp: number | undefined, timestamp: number | undefined,
map: StringToNumberMap map: StringToNumberMap
): Promise<boolean> { ): Promise<boolean> {
if (!timestamp) { if (map[device] === timestamp) {
if (device in map) {
// tslint:disable-next-line: no-dynamic-delete
delete map[device];
return true;
}
return false; return false;
} }
map[device] = timestamp; if (!timestamp) {
// tslint:disable-next-line: no-dynamic-delete
delete map[device];
} else {
map[device] = timestamp;
}
return true; return true;
} }

Loading…
Cancel
Save