Ejemplo n.º 1
0
def send_note_emails(note):
    if not waffle.switch_is_active("comm-dashboard"):
        return

    recipients = get_recipients(note, False)
    name = note.thread.addon.name
    data = {"name": name, "sender": note.author.name, "comments": note.body, "thread_id": str(note.thread.id)}
    for email, tok in recipients:
        reply_to = "{0}{1}@{2}".format(comm.REPLY_TO_PREFIX, tok, settings.POSTFIX_DOMAIN)
        subject = u"%s has been reviewed." % name
        send_mail(
            subject,
            "reviewers/emails/decisions/post.txt",
            data,
            [email],
            perm_setting="app_reviewed",
            reply_to=reply_to,
        )
Ejemplo n.º 2
0
    def notify_email(self, template, subject, fresh_thread=False):
        """Notify the authors that their app has been reviewed."""
        data = self.data.copy()
        data.update(self.get_context_data())
        data["tested"] = ""
        dt, br = data.get("device_types"), data.get("browsers")
        if dt and br:
            data["tested"] = "Tested on %s with %s" % (dt, br)
        elif dt and not br:
            data["tested"] = "Tested on %s" % dt
        elif not dt and br:
            data["tested"] = "Tested with %s" % br

        if waffle.switch_is_active("comm-dashboard"):
            # Send via Commbadge.
            recipients = get_recipients(self.comm_note)

            data["thread_id"] = str(self.comm_thread.id)
            for email, tok in recipients:
                subject = u"%s has been reviewed." % data["name"]
                reply_to = "{0}{1}@{2}".format(comm.REPLY_TO_PREFIX, tok, settings.POSTFIX_DOMAIN)
                send_mail(
                    subject,
                    "reviewers/emails/decisions/%s.txt" % template,
                    data,
                    [email],
                    perm_setting="app_reviewed",
                    attachments=self.get_attachments(),
                    reply_to=reply_to,
                )
        else:
            emails = list(self.addon.authors.values_list("email", flat=True))
            cc_email = self.addon.mozilla_contact or None

            send_mail(
                subject % data["name"],
                "reviewers/emails/decisions/%s.txt" % template,
                data,
                emails,
                perm_setting="app_reviewed",
                cc=cc_email,
                attachments=self.get_attachments(),
            )