From 1c899a23a9850271da32d4ea02f10fcaf41bd4b2 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Mon, 22 Sep 2014 10:36:37 -0300 Subject: showing draft even if json has no recipients --- web-ui/app/js/mixins/with_mail_edit_base.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'web-ui/app/js/mixins') diff --git a/web-ui/app/js/mixins/with_mail_edit_base.js b/web-ui/app/js/mixins/with_mail_edit_base.js index 4710cb74..2882758c 100644 --- a/web-ui/app/js/mixins/with_mail_edit_base.js +++ b/web-ui/app/js/mixins/with_mail_edit_base.js @@ -58,6 +58,12 @@ define( Recipients.attachTo(this.select('bccArea'), { name: 'bcc', addresses: context.recipients.bcc || []}); }; + function thereAreRecipientsToDisplay() { + return this.attr.recipientValues.to + && this.attr.recipientValues.cc + && !_.isEmpty(this.attr.recipientValues.to.concat(this.attr.recipientValues.cc)); + } + this.render = function(template, context) { this.$node.html(template(context)); @@ -71,7 +77,7 @@ define( this.on(this.select('trashButton'), 'click', this.trashMail); SendButton.attachTo(this.select('sendButton')); - if (!_.isEmpty(this.attr.recipientValues.to.concat(this.attr.recipientValues.cc))) { + if (thereAreRecipientsToDisplay.call(this)) { this.trigger(document, events.ui.sendbutton.enable); } }; @@ -190,7 +196,6 @@ define( this.on(document, events.ui.mail.send, this.sendMail); this.on(document, events.ui.tag.selected, this.saveTag); - }); } -- cgit v1.2.3