(js) Fix message initialization in popup window

Fixes #3583
This commit is contained in:
Francis Lachapelle
2016-03-15 09:59:57 -04:00
parent 0af364d076
commit dec3f94392
3 changed files with 6 additions and 4 deletions
@@ -179,7 +179,7 @@
// Message is available from the parent window
message = new Message(stateMailbox.$account.id,
stateMailbox,
window.opener.$messageController.message.$omit());
window.opener.$messageController.message.$omit({privateAttributes: true}));
return $q.when(message);
}
else {
@@ -648,10 +648,11 @@
* @desc Return a sanitized object used to send to the server.
* @return an object literal copy of the Message instance
*/
Message.prototype.$omit = function() {
var message = {};
Message.prototype.$omit = function(options) {
var message = {},
privateAttributes = options && options.privateAttributes;
angular.forEach(this, function(value, key) {
if (key != 'constructor' && key[0] != '$') {
if (key != 'constructor' && key[0] != '$' || privateAttributes) {
message[key] = value;
}
});