updateSessionTimestamp: return false if no write to DB needed

pull/1172/head
Audric Ackermann 5 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;
try {
conversation = window.ConversationController.get(number);
if(conversation) {
if (conversation) {
await conversation.onSessionResetReceived();
} else {
throw new Error();

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

Loading…
Cancel
Save