示例#1
0
def send_mail_comm(note):
    """
    Email utility used globally by the Communication Dashboard to send emails.
    Given a note (its actions and permissions), recipients are determined and
    emails are sent to appropriate people.
    """
    from mkt.reviewers.utils import send_reviewer_mail

    if not waffle.switch_is_active('comm-dashboard'):
        return

    recipients = get_recipients(note)
    name = note.thread.addon.name
    data = {
        'name': name,
        'sender': note.author.name if note.author else 'System',
        'comments': note.body,
        'thread_id': str(note.thread.id)
    }

    subject = {
        comm.ESCALATION: u'Escalated Review Requested: %s' % name,
    }.get(note.note_type, u'Submission Update: %s' % name)

    log.info(u'Sending emails for %s' % note.thread.addon)
    for email, tok in recipients:
        reply_to = '{0}{1}@{2}'.format(comm.REPLY_TO_PREFIX, tok,
                                       settings.POSTFIX_DOMAIN)
        send_reviewer_mail(subject, 'reviewers/emails/decisions/post.txt', data,
                           [email], perm_setting='app_reviewed',
                           reply_to=reply_to)
示例#2
0
def escalate_app(app, version, user, msg, email_template, log_type):
    # Add to escalation queue
    EscalationQueue.objects.get_or_create(addon=app)

    # Create comm note
    create_comm_note(app, version, user, msg,
                     note_type=comm.ACTION_MAP(log_type))

    # Log action
    amo.log(log_type, app, version, created=datetime.now(),
            details={'comments': msg})
    log.info(u'[app:%s] escalated - %s' % (app.name, msg))

    # Special senior reviewer email.
    if not waffle.switch_is_active('comm-dashboard'):
        context = {'name': app.name,
                   'review_url': absolutify(reverse('reviewers.apps.review',
                                                    args=[app.app_slug])),
                   'SITE_URL': settings.SITE_URL}
        send_reviewer_mail(u'%s: %s' % (msg, app.name), email_template, context,
                           [settings.MKT_SENIOR_EDITORS_EMAIL])