Merge pull request #1127 from Mikunj/fix-background-message

pull/1130/head
Audric Ackermann 5 years ago committed by GitHub
commit 09d8d67386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1250,6 +1250,13 @@ MessageReceiver.prototype.extend({
return this.removeFromCache(envelope);
}
if (!friendRequest && this.isMessageEmpty(message)) {
window.log.warn(
`Message ${this.getEnvelopeId(envelope)} ignored; it was empty`
);
return this.removeFromCache(envelope);
}
const ev = new Event('message');
ev.confirm = this.removeFromCache.bind(this, envelope);
ev.data = {
@ -1265,6 +1272,27 @@ MessageReceiver.prototype.extend({
})
);
},
isMessageEmpty({
body,
attachments,
group,
flags,
quote,
contact,
preview,
groupInvitation,
}) {
return (
!flags &&
_.isEmpty(body) &&
_.isEmpty(attachments) &&
_.isEmpty(group) &&
_.isEmpty(quote) &&
_.isEmpty(contact) &&
_.isEmpty(preview) &&
_.isEmpty(groupInvitation)
);
},
handleLegacyMessage(envelope) {
return this.decrypt(envelope, envelope.legacyMessage).then(plaintext => {
if (!plaintext) {

Loading…
Cancel
Save