action: function()

in js/newsletters/send-emails-to-recipients.js [13:30]


  action: function(ctx) {
    var issue = ctx.issue;
    
    workflow.check(issue.reporter.login === ctx.currentUser.login,
      'Only ' + issue.reporter.fullName + ' can send this newsletter!');
    
    var emails = filter.getUniqueEmails(issue.fields.Recipients, issue.reporter.email);
    var message = composer.composeMessage(issue, emails);
    notifications.sendEmail(message, issue);
    
    issue.fields.Recipients.forEach(function(group) {
      issue.permittedGroups.add(group);
    });

    var newComment = issue.addComment('Newsletter was sent to ' +
      emails.length + ' recipient(s).');
    newComment.permittedUsers.add(issue.reporter);
  },