(js) Fix composition of new msgs from Contacts

pull/210/head
Francis Lachapelle 2016-05-19 15:58:26 -04:00
parent 35d549121d
commit fdc82913ef
2 changed files with 8 additions and 7 deletions

3
NEWS
View File

@ -2,7 +2,8 @@
------------------ ------------------
Bug fixes Bug fixes
- [web] fix creation of chip on blur (sgTransformOnBlur directive) - [web] fixed creation of chip on blur (sgTransformOnBlur directive)
- [web] fixed composition of new messages from Contacts module
3.1.0 (2016-05-18) 3.1.0 (2016-05-18)
------------------ ------------------

View File

@ -140,6 +140,7 @@
// list before proceeding with message's creation // list before proceeding with message's creation
account.$getMailboxes().then(function(mailboxes) { account.$getMailboxes().then(function(mailboxes) {
account.$newMessage().then(function(message) { account.$newMessage().then(function(message) {
angular.extend(message.editable, { to: recipients });
$mdDialog.show({ $mdDialog.show({
parent: angular.element(document.body), parent: angular.element(document.body),
targetEvent: $event, targetEvent: $event,
@ -150,8 +151,7 @@
controllerAs: 'editor', controllerAs: 'editor',
locals: { locals: {
stateAccount: account, stateAccount: account,
stateMessage: message, stateMessage: message
stateRecipients: recipients
} }
}); });
}); });
@ -160,7 +160,7 @@
} }
function newMessageWithRecipient($event, recipient, fn) { function newMessageWithRecipient($event, recipient, fn) {
var recipients = [{full: fn + ' <' + recipient + '>'}]; var recipients = [fn + ' <' + recipient + '>'];
vm.newMessage($event, recipients); vm.newMessage($event, recipients);
$event.stopPropagation(); $event.stopPropagation();
$event.preventDefault(); $event.preventDefault();
@ -172,14 +172,14 @@
_.forEach(selectedCards, function(card) { _.forEach(selectedCards, function(card) {
if (card.c_component == 'vcard' && card.c_mail.length) { if (card.c_component == 'vcard' && card.c_mail.length) {
recipients.push({full: card.c_cn + ' <' + card.c_mail + '>'}); recipients.push(card.c_cn + ' <' + card.c_mail + '>');
} }
else if (card.$isList()) { else if (card.$isList()) {
// If the list's members were already fetch, use them // If the list's members were already fetch, use them
if (angular.isDefined(card.refs) && card.refs.length) { if (angular.isDefined(card.refs) && card.refs.length) {
_.forEach(card.refs, function(ref) { _.forEach(card.refs, function(ref) {
if (ref.email.length) if (ref.email.length)
recipients.push({full: ref.c_cn + ' <' + ref.email + '>'}); recipients.push(ref.c_cn + ' <' + ref.email + '>');
}); });
} }
else { else {
@ -187,7 +187,7 @@
return card.$futureCardData.then(function(data) { return card.$futureCardData.then(function(data) {
_.forEach(data.refs, function(ref) { _.forEach(data.refs, function(ref) {
if (ref.email.length) if (ref.email.length)
recipients.push({full: ref.c_cn + ' <' + ref.email + '>'}); recipients.push(ref.c_cn + ' <' + ref.email + '>');
}); });
}); });
})); }));