Page MenuHomePhabricator

D10256.diff
No OneTemporary

D10256.diff

diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -1886,14 +1886,18 @@
$template->addHeader('X-Herald-Rules', $herald_header);
}
+ if ($object instanceof PhabricatorProjectInterface) {
+ $this->addMailProjectMetadata($object, $template);
+ }
+
if ($this->getParentMessageID()) {
$template->setParentMessageID($this->getParentMessageID());
}
$mails = $reply_handler->multiplexMail(
- $template,
- array_select_keys($handles, $email_to),
- array_select_keys($handles, $email_cc));
+ $template,
+ array_select_keys($handles, $email_to),
+ array_select_keys($handles, $email_cc));
foreach ($mails as $mail) {
$mail->saveAndSend();
@@ -1905,6 +1909,44 @@
return $template;
}
+ private function addMailProjectMetadata(
+ PhabricatorLiskDAO $object,
+ PhabricatorMetaMTAMail $template) {
+
+ $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $object->getPHID(),
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+
+ if (!$project_phids) {
+ return;
+ }
+
+ // TODO: This viewer isn't quite right. It would be slightly better to use
+ // the mail recipient, but that's not very easy given the way rendering
+ // works today.
+
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($this->requireActor())
+ ->withPHIDs($project_phids)
+ ->execute();
+
+ $project_tags = array();
+ foreach ($handles as $handle) {
+ if (!$handle->isComplete()) {
+ continue;
+ }
+ $project_tags[] = '<'.$handle->getObjectName().'>';
+ }
+
+ if (!$project_tags) {
+ return;
+ }
+
+ $project_tags = implode(', ', $project_tags);
+ $template->addHeader('X-Phabricator-Projects', $project_tags);
+ }
+
+
protected function getMailThreadID(PhabricatorLiskDAO $object) {
return $object->getPHID();
}

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 11:03 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6293613
Default Alt Text
D10256.diff (2 KB)

Event Timeline