Display a default message for incoming message errors

An exception to the previous commit, for incoming messages we should not
show a mysterious empty bubble. Instead there is some generic
non-technical error message.

// FREEBIE
This commit is contained in:
lilia 2015-09-30 15:22:59 -07:00
parent 929c16090b
commit a802322d44
2 changed files with 8 additions and 3 deletions

View file

@ -59,7 +59,7 @@
return 'Received message with unknown identity key.'; return 'Received message with unknown identity key.';
} }
if (this.isIncoming() && this.hasErrors()) { if (this.isIncoming() && this.hasErrors()) {
return 'Error decrypting incoming message.'; return 'Error handling incoming message.';
} }
return this.get('body'); return this.get('body');

View file

@ -34,7 +34,12 @@
}, },
renderErrors: function() { renderErrors: function() {
var errors = this.model.get('errors'); var errors = this.model.get('errors');
if (_.size(errors) > 0) { this.$el.addClass('error'); } if (_.size(errors) > 0) {
this.$el.addClass('error');
if (this.model.isIncoming()) {
this.$('.content').text(this.model.getDescription()).addClass('error-message');
}
}
}, },
renderControl: function() { renderControl: function() {
if (this.model.isEndSession() || this.model.isGroupUpdate()) { if (this.model.isEndSession() || this.model.isGroupUpdate()) {
@ -63,8 +68,8 @@
this.renderSent(); this.renderSent();
this.renderDelivered(); this.renderDelivered();
this.renderErrors();
this.renderControl(); this.renderControl();
this.renderErrors();
this.$('.attachments').append( this.$('.attachments').append(
this.model.get('attachments').map(function(attachment) { this.model.get('attachments').map(function(attachment) {