diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index c3c65f30f4..bf96f99a7b 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -466,7 +466,7 @@ MessageReceiver.prototype.extend({ window.log.info('getAllFromCache'); const count = await textsecure.storage.unprocessed.getCount(); - if (count > 250) { + if (count > 1500) { await textsecure.storage.unprocessed.removeAll(); window.log.warn( `There were ${count} messages in cache. Deleted all instead of reprocessing` @@ -719,12 +719,14 @@ MessageReceiver.prototype.extend({ // Here we take this sender information and attach it back to the envelope // to make the rest of the app work properly. + const originalSource = envelope.source; + // eslint-disable-next-line no-param-reassign envelope.source = sender.getName(); // eslint-disable-next-line no-param-reassign envelope.sourceDevice = sender.getDeviceId(); // eslint-disable-next-line no-param-reassign - envelope.unidentifiedDeliveryReceived = true; + envelope.unidentifiedDeliveryReceived = !originalSource; // Return just the content because that matches the signature of the other // decrypt methods used above. @@ -734,12 +736,14 @@ MessageReceiver.prototype.extend({ const { sender } = error || {}; if (sender) { + const originalSource = envelope.source; + // eslint-disable-next-line no-param-reassign envelope.source = sender.getName(); // eslint-disable-next-line no-param-reassign envelope.sourceDevice = sender.getDeviceId(); // eslint-disable-next-line no-param-reassign - envelope.unidentifiedDeliveryReceived = true; + envelope.unidentifiedDeliveryReceived = !originalSource; throw error; } diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 20e66e4c62..56908d13ad 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -2352,7 +2352,7 @@ "rule": "jQuery-wrap(", "path": "libtextsecure/message_receiver.js", "line": " const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);", - "lineNumber": 781, + "lineNumber": 785, "reasonCategory": "falseMatch", "updated": "2018-09-19T18:13:29.628Z" }, @@ -2360,7 +2360,7 @@ "rule": "jQuery-wrap(", "path": "libtextsecure/message_receiver.js", "line": " const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);", - "lineNumber": 806, + "lineNumber": 810, "reasonCategory": "falseMatch", "updated": "2018-09-19T18:13:29.628Z" },