Ejemplo n.º 1
0
 def parse(cls, body: dict):
     return cls(
         Recipient.parse_many(body["reviewers"]),
         Recipient.parse_many(body["subscribers"]),
         body["commentCount"],
         body["transactionLink"],
     )
Ejemplo n.º 2
0
 def parse(cls, body: dict):
     return cls(
         Recipient.parse_optional(body.get("author")),
         Recipient.parse_many(body["reviewers"]),
         Recipient.parse_many(body["subscribers"]),
         body["transactionLink"],
     )
Ejemplo n.º 3
0
 def parse(cls, body: dict):
     return cls(
         body.get("landoLink"),
         body["isReadyToLand"],
         Recipient.parse_optional(body.get("author")),
         Recipient.parse_many(body["reviewers"]),
         Recipient.parse_many(body["subscribers"]),
         body["commentCount"],
         body["transactionLink"],
     )
Ejemplo n.º 4
0
    def process_event_to_emails_with_minimal_context(
            self, timestamp: int, context: dict, thread_store: ThreadStore):
        """Turn the minimal Phabricator context into outgoing emails."""
        revision = MinimalRevision.parse(context["revision"])
        recipients = Recipient.parse_many(context["recipients"])
        thread = thread_store.get_or_create(revision.id)
        thread.email_count += 1
        emails = []
        for recipient in recipients:
            if recipient.is_actor:
                continue

            template = self._template_store.get("minimal")
            html_email, text_email = template.render({
                "revision":
                revision,
                "recipient_username":
                recipient.username,
                "unique_number":
                thread.email_count,
                "event":
                context,
            })
            emails.append(
                OutgoingEmail(
                    "minimal",
                    f"D{revision.id}",
                    recipient.email,
                    timestamp,
                    html_email,
                    text_email,
                ))
        return emails
Ejemplo n.º 5
0
 def parse(cls, body: dict):
     return cls(
         body["isReadyToLand"],
         body["newChangesLink"],
         Reviewer.parse_many(body["reviewers"]),
         Recipient.parse_many(body["subscribers"]),
     )
Ejemplo n.º 6
0
 def parse(cls, reviewer: Dict):
     return cls(
         reviewer["name"],
         reviewer["isActionable"],
         ReviewerStatus(reviewer["status"]),
         ExistenceChange(reviewer["metadataChange"]),
         Recipient.parse_many(reviewer["recipients"]),
     )
Ejemplo n.º 7
0
 def parse(cls, body: dict):
     return cls(
         Reviewer.parse_many(body["reviewers"]),
         Recipient.parse_many(body["subscribers"]),
     )