Esempio n. 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_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, "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_mail(
            subject,
            "reviewers/emails/decisions/post.txt",
            data,
            [email],
            perm_setting="app_reviewed",
            reply_to=reply_to,
        )
Esempio n. 2
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_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,
        '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_mail(subject,
                  'reviewers/emails/decisions/post.txt',
                  data, [email],
                  perm_setting='app_reviewed',
                  reply_to=reply_to)
Esempio n. 3
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_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_mail(subject, 'reviewers/emails/decisions/post.txt', data,
                  [email], perm_setting='app_reviewed', reply_to=reply_to)
Esempio n. 4
0
def handle_vip(addon, version, user):
    msg = u'VIP app updated'

    # Add to escalation queue
    EscalationQueue.objects.get_or_create(addon=addon)

    # Create comm note
    create_comm_note(addon, version, user, msg, note_type=comm.ESCALATION,
                     perms={'developer': False})

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

    # Special senior reviewer email.
    if not waffle.switch_is_active('comm-dashboard'):
        context = {'name': addon.name,
                   'review_url': absolutify(reverse('reviewers.apps.review',
                                                     args=[addon.app_slug],
                                                     add_prefix=False)),
                   'SITE_URL': settings.SITE_URL}
        send_mail(u'%s: %s' % (msg, addon.name),
                   'developers/emails/vip_escalation.ltxt', context,
                   [settings.MKT_SENIOR_EDITORS_EMAIL])
Esempio n. 5
0
def handle_vip(addon, version, user):
    msg = u'VIP app updated'

    # Add to escalation queue
    EscalationQueue.objects.get_or_create(addon=addon)

    # Create comm note
    create_comm_note(addon,
                     version,
                     user,
                     msg,
                     note_type=comm.ESCALATION,
                     perms={'developer': False})

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

    # Special senior reviewer email.
    if not waffle.switch_is_active('comm-dashboard'):
        context = {
            'name':
            addon.name,
            'review_url':
            absolutify(
                reverse('reviewers.apps.review',
                        args=[addon.app_slug],
                        add_prefix=False)),
            'SITE_URL':
            settings.SITE_URL
        }
        send_mail(u'%s: %s' % (msg, addon.name),
                  'developers/emails/vip_escalation.ltxt', context,
                  [settings.MKT_SENIOR_EDITORS_EMAIL])
Esempio n. 6
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.ESCALATION,
                     perms={'developer': False})

    # 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],
                                                    add_prefix=False)),
                   'SITE_URL': settings.SITE_URL}
        send_mail(u'%s: %s' % (msg, app.name),
                  email_template,
                  context,
                  [settings.MKT_SENIOR_EDITORS_EMAIL])