From f6d4cc4896ce330780e53af106aac1dfcfdc644f Mon Sep 17 00:00:00 2001 From: vrana Date: Sun, 26 Feb 2012 21:22:04 -0800 Subject: [PATCH] Send custom headers for author, reviewer and cc in Differential e-mails Summary: I want to flag messages which require an immediate action from me in e-mail client. It is currently not possible because Author and Reviewers fields are both in To:. So the filtering rule cannot recognize if I am the person who should take the action. This diff adds these headers: - X-Differential-Author - X-Differential-Reviewers - X-Differential-CCs Test Plan: Send comment to the diff. Verify X-Differential-* headers. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Maniphest Tasks: T808 Differential Revision: https://secure.phabricator.com/D1724 --- .../mail/base/DifferentialMail.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/applications/differential/mail/base/DifferentialMail.php b/src/applications/differential/mail/base/DifferentialMail.php index 2a4351a9f0..51eab73957 100644 --- a/src/applications/differential/mail/base/DifferentialMail.php +++ b/src/applications/differential/mail/base/DifferentialMail.php @@ -100,6 +100,25 @@ abstract class DifferentialMail { $template->addHeader('X-Herald-Rules', $this->heraldRulesHeader); } + $revision = $this->revision; + if ($revision) { + if ($revision->getAuthorPHID()) { + $template->addHeader( + 'X-Differential-Author', + '<'.$revision->getAuthorPHID().'>'); + } + if ($revision->getReviewers()) { + $template->addHeader( + 'X-Differential-Reviewers', + '<'.implode('>, <', $revision->getReviewers()).'>'); + } + if ($revision->getCCPHIDs()) { + $template->addHeader( + 'X-Differential-CCs', + '<'.implode('>, <', $revision->getCCPHIDs()).'>'); + } + } + $template->setIsBulk(true); $template->setRelatedPHID($this->getRevision()->getPHID());