write using 'to', 'cc' or 'bcc'

write to multiple selected contacts using 'to', 'cc' or 'bcc'
Feauture Request #3548
pull/232/head
Steffen Müller 2017-01-26 19:27:13 +01:00 committed by GitHub
parent 8efd01d55e
commit ed62670a1a
1 changed files with 14 additions and 5 deletions

View File

@ -319,7 +319,7 @@
vm.selectedFolder.$filter('');
}
function newMessage($event, recipients) {
function newMessage($event, recipients, recipientsField) {
Account.$findAll().then(function(accounts) {
var account = _.find(accounts, function(o) {
if (o.id === 0)
@ -330,7 +330,16 @@
// list before proceeding with message's creation
account.$getMailboxes().then(function(mailboxes) {
account.$newMessage().then(function(message) {
angular.extend(message.editable, { to: recipients });
switch(recipientsField) {
case 0:
angular.extend(message.editable, { to: recipients });
break;
case 1:
angular.extend(message.editable, { cc: recipients });
break;
case 2:
angular.extend(message.editable, { bcc: recipients });
}
$mdDialog.show({
parent: angular.element(document.body),
targetEvent: $event,
@ -351,12 +360,12 @@
function newMessageWithRecipient($event, recipient, fn) {
var recipients = [fn + ' <' + recipient + '>'];
vm.newMessage($event, recipients);
vm.newMessage($event, recipients, 0);
$event.stopPropagation();
$event.preventDefault();
}
function newMessageWithSelectedCards($event) {
function newMessageWithSelectedCards($event, recipientsField) {
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
var promises = [], recipients = [];
@ -386,7 +395,7 @@
$q.all(promises).then(function() {
recipients = _.uniq(recipients);
if (recipients.length)
vm.newMessage($event, recipients);
vm.newMessage($event, recipients, recipientsField);
});
}
}