diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js index 174faefe0..b202b5054 100644 --- a/UI/WebServerResources/js/Mailer/Message.service.js +++ b/UI/WebServerResources/js/Mailer/Message.service.js @@ -662,7 +662,7 @@ action = 'markMessageUncollapse'; this.collapsed = !this.collapsed; - _this.$mailbox.updateVisibleMessages(); + this.$mailbox.updateVisibleMessages(); return Message.$$resource.post(this.$absolutePath(), action).catch(function() { this.collapsed = !this.collapsed; @@ -717,32 +717,33 @@ * information parsed from the specified "mailto:" link. */ Message.prototype.$parseMailto = function(mailto) { - var to, data, match = /^mailto:([^\?]+)/.exec(mailto); + var to, data = {}, match = /^mailto:([^\?]+)/.exec(mailto); if (match) { // Recipients to = _.map(decodeURIComponent(match[1]).split(','), function(email) { return '<' + email.trim() + '>'; }); data = { to: to }; - // Subject & body - _.forEach(['subject', 'body'], function(param) { - var re = new RegExp(param + '=([^&]+)'); - param = (param == 'body')? 'text' : param; - match = re.exec(mailto); - if (match) - data[param] = decodeURIComponent(match[1]); - }); - // Other Recipients - _.forEach(['cc', 'bcc'], function(param) { - var re = new RegExp(param + '=([^&]+)'); - match = re.exec(mailto); - if (match) - data[param] = _.map(decodeURIComponent(match[1]).split(','), function(email) { - return '<' + email.trim() + '>'; - }); - }); - angular.extend(this.editable, data); } + // Subject & body + _.forEach(['subject', 'body'], function(param) { + var re = new RegExp(param + '=([^&]+)'); + param = (param == 'body')? 'text' : param; + match = re.exec(mailto); + if (match) + data[param] = decodeURIComponent(match[1]); + }); + // Other Recipients + _.forEach(['cc', 'bcc'], function(param) { + var re = new RegExp(param + '=([^&]+)'); + match = re.exec(mailto); + if (match) + data[param] = _.map(decodeURIComponent(match[1]).split(','), function(email) { + return '<' + email.trim() + '>'; + }); + }); + if (!_.isEmpty(data)) + angular.extend(this.editable, data); }; /**