Refactor 'waiting' flags into one location, fix timestamp check
This commit is contained in:
parent
fd36720079
commit
e18b6bed1f
6 changed files with 39 additions and 13 deletions
|
@ -1304,13 +1304,19 @@ MessageReceiver.prototype.extend({
|
|||
// Note that messages may (generally) only perform one action and we ignore remaining
|
||||
// fields after the first action.
|
||||
|
||||
const TIMESTAMP_VALIDATION = false;
|
||||
if (TIMESTAMP_VALIDATION && envelope.timestamp !== decrypted.timestamp) {
|
||||
throw new Error(
|
||||
`Timestamp ${
|
||||
decrypted.timestamp
|
||||
} in DataMessage did not match envelope timestamp ${envelope.timestamp}`
|
||||
);
|
||||
if (window.TIMESTAMP_VALIDATION) {
|
||||
const envelopeTimestamp = envelope.timestamp.toNumber();
|
||||
const decryptedTimestamp = decrypted.timestamp.toNumber();
|
||||
|
||||
if (envelopeTimestamp !== decryptedTimestamp) {
|
||||
throw new Error(
|
||||
`Timestamp ${
|
||||
decrypted.timestamp
|
||||
} in DataMessage did not match envelope timestamp ${
|
||||
envelope.timestamp
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (decrypted.flags == null) {
|
||||
|
|
|
@ -185,7 +185,7 @@ MessageSender.prototype = {
|
|||
},
|
||||
|
||||
getPaddedAttachment(data, shouldPad) {
|
||||
if (!shouldPad) {
|
||||
if (!window.PAD_ALL_ATTACHMENTS && !shouldPad) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue