Conversation view blocks sending to left groups

Instead of attempting to send, which will throw an 'Unknown group' exception,
show a toast.

// FREEBIE
This commit is contained in:
lilia 2017-05-12 15:16:02 -07:00 committed by Lilia
parent a5831ef9f8
commit cfe0c77243
2 changed files with 15 additions and 3 deletions

View file

@ -1,4 +1,8 @@
{
"youLeftTheGroup": {
"message": "You left the group",
"description": "Displayed when a user can't send a message because they have left the group"
},
"debugLogExplanation": {
"message": "This log will be posted publicly online for contributors to view. You may examine and edit it before submitting."
},

View file

@ -15,6 +15,11 @@
return { toastMessage: i18n('unblockToSend') };
}
});
Whisper.LeftGroupToast = Whisper.ToastView.extend({
render_attributes: function() {
return { toastMessage: i18n('youLeftTheGroup') };
}
});
var MenuView = Whisper.View.extend({
toggleMenu: function() {
@ -343,12 +348,15 @@
var toast;
if (extension.expired()) {
toast = new Whisper.ExpiredToast();
toast.$el.insertAfter(this.$el);
toast.render();
return;
}
if (this.model.isPrivate() && storage.isBlocked(this.model.id)) {
toast = new Whisper.BlockedToast();
}
if (!this.model.isPrivate() && this.model.get('left')) {
toast = new Whisper.LeftGroupToast();
}
if (toast) {
toast.$el.insertAfter(this.$el);
toast.render();
return;