Conversation view blocks sending to left groups

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

// FREEBIE
pull/749/head
lilia 8 years ago committed by Lilia
parent a5831ef9f8
commit cfe0c77243

@ -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": { "debugLogExplanation": {
"message": "This log will be posted publicly online for contributors to view. You may examine and edit it before submitting." "message": "This log will be posted publicly online for contributors to view. You may examine and edit it before submitting."
}, },

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

Loading…
Cancel
Save