diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index 049733f777..c39be75366 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -473,17 +473,14 @@ final class PhabricatorAuditEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $identifier = $object->getCommitIdentifier(); $repository = $object->getRepository(); - $monogram = $repository->getMonogram(); $summary = $object->getSummary(); $name = $repository->formatCommitName($identifier); $subject = "{$name}: {$summary}"; - $thread_topic = "Commit {$monogram}{$identifier}"; $template = id(new PhabricatorMetaMTAMail()) - ->setSubject($subject) - ->addHeader('Thread-Topic', $thread_topic); + ->setSubject($subject); $this->attachPatch( $template, diff --git a/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php b/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php index 569c37403b..3f178c9855 100644 --- a/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php +++ b/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php @@ -255,11 +255,9 @@ final class PhabricatorAuthSSHKeyEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); $name = $object->getName(); - $phid = $object->getPHID(); $mail = id(new PhabricatorMetaMTAMail()) - ->setSubject(pht('SSH Key %d: %s', $id, $name)) - ->addHeader('Thread-Topic', $phid); + ->setSubject(pht('SSH Key %d: %s', $id, $name)); // The primary value of this mail is alerting users to account compromises, // so force delivery. In particular, this mail should still be delivered diff --git a/src/applications/badges/editor/PhabricatorBadgesEditor.php b/src/applications/badges/editor/PhabricatorBadgesEditor.php index fddc55747c..785d8c989b 100644 --- a/src/applications/badges/editor/PhabricatorBadgesEditor.php +++ b/src/applications/badges/editor/PhabricatorBadgesEditor.php @@ -87,12 +87,10 @@ final class PhabricatorBadgesEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $name = $object->getName(); $id = $object->getID(); - $topic = pht('Badge %d', $id); $subject = pht('Badge %d: %s', $id, $name); return id(new PhabricatorMetaMTAMail()) - ->setSubject($subject) - ->addHeader('Thread-Topic', $topic); + ->setSubject($subject); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 4ab13fd360..f1b72dc0ea 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -309,13 +309,11 @@ final class PhabricatorCalendarEventEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $id = $object->getID(); $name = $object->getName(); $monogram = $object->getMonogram(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("{$monogram}: {$name}") - ->addHeader('Thread-Topic', $monogram); + ->setSubject("{$monogram}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php index 29ffc22251..7896055f64 100644 --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -227,11 +227,9 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { '%s sent you a message.', $this->getActor()->getUserName()); } - $phid = $object->getPHID(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("Z{$id}: {$title}") - ->addHeader('Thread-Topic', "Z{$id}: {$phid}"); + ->setSubject("Z{$id}: {$title}"); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/countdown/editor/PhabricatorCountdownEditor.php b/src/applications/countdown/editor/PhabricatorCountdownEditor.php index 322b2ee2c3..2102b3785b 100644 --- a/src/applications/countdown/editor/PhabricatorCountdownEditor.php +++ b/src/applications/countdown/editor/PhabricatorCountdownEditor.php @@ -45,8 +45,7 @@ final class PhabricatorCountdownEditor $name = $object->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("{$monogram}: {$name}") - ->addHeader('Thread-Topic', $monogram); + ->setSubject("{$monogram}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 3a1537b01d..f3583438c8 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -689,15 +689,10 @@ final class DifferentialTransactionEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); $title = $object->getTitle(); - - $original_title = $object->getOriginalTitle(); - $subject = "D{$id}: {$title}"; - $thread_topic = "D{$id}: {$original_title}"; return id(new PhabricatorMetaMTAMail()) - ->setSubject($subject) - ->addHeader('Thread-Topic', $thread_topic); + ->setSubject($subject); } protected function getTransactionsForMail( diff --git a/src/applications/files/editor/PhabricatorFileEditor.php b/src/applications/files/editor/PhabricatorFileEditor.php index 6a2b797b40..db974cec65 100644 --- a/src/applications/files/editor/PhabricatorFileEditor.php +++ b/src/applications/files/editor/PhabricatorFileEditor.php @@ -47,8 +47,7 @@ final class PhabricatorFileEditor $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("F{$id}: {$name}") - ->addHeader('Thread-Topic', "F{$id}"); + ->setSubject("F{$id}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php index e5c372fd12..9175156ffd 100644 --- a/src/applications/fund/editor/FundInitiativeEditor.php +++ b/src/applications/fund/editor/FundInitiativeEditor.php @@ -50,8 +50,7 @@ final class FundInitiativeEditor $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("{$monogram}: {$name}") - ->addHeader('Thread-Topic', $monogram); + ->setSubject("{$monogram}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/legalpad/editor/LegalpadDocumentEditor.php b/src/applications/legalpad/editor/LegalpadDocumentEditor.php index 35f2487a81..e4b43186ee 100644 --- a/src/applications/legalpad/editor/LegalpadDocumentEditor.php +++ b/src/applications/legalpad/editor/LegalpadDocumentEditor.php @@ -124,12 +124,10 @@ final class LegalpadDocumentEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); - $phid = $object->getPHID(); $title = $object->getDocumentBody()->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("L{$id}: {$title}") - ->addHeader('Thread-Topic', "L{$id}: {$phid}"); + ->setSubject("L{$id}: {$title}"); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/macro/editor/PhabricatorMacroEditor.php b/src/applications/macro/editor/PhabricatorMacroEditor.php index 5d28b78f5f..f59c29b426 100644 --- a/src/applications/macro/editor/PhabricatorMacroEditor.php +++ b/src/applications/macro/editor/PhabricatorMacroEditor.php @@ -35,8 +35,7 @@ final class PhabricatorMacroEditor $name = 'Image Macro "'.$name.'"'; return id(new PhabricatorMetaMTAMail()) - ->setSubject($name) - ->addHeader('Thread-Topic', $name); + ->setSubject($name); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php index caf70b8f3c..9c8e3869dc 100644 --- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php @@ -206,8 +206,7 @@ final class ManiphestTransactionEditor $title = $object->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("T{$id}: {$title}") - ->addHeader('Thread-Topic', "T{$id}: ".$object->getOriginalTitle()); + ->setSubject("T{$id}: {$title}"); } protected function buildMailBody( diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php index 83cdc7c40f..f2c8939132 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -1262,6 +1262,11 @@ final class PhabricatorMetaMTAMail $headers[] = array('X-Phabricator-Must-Encrypt', 'Yes'); } + $related_phid = $this->getRelatedPHID(); + if ($related_phid) { + $headers[] = array('Thread-Topic', $related_phid); + } + return $headers; } @@ -1309,6 +1314,7 @@ final class PhabricatorMetaMTAMail 'Precedence', 'References', 'Thread-Index', + 'Thread-Topic', 'X-Mail-Transport-Agent', 'X-Auto-Response-Suppress', diff --git a/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php b/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php index 40657abd57..c6aad6e2bd 100644 --- a/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php +++ b/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php @@ -46,12 +46,10 @@ final class PhabricatorOwnersPackageTransactionEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $id = $object->getID(); $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject($name) - ->addHeader('Thread-Topic', $object->getPHID()); + ->setSubject($name); } protected function buildMailBody( diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 063b72cfc0..c312915727 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -72,8 +72,7 @@ final class PhabricatorPasteEditor $name = $object->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("P{$id}: {$name}") - ->addHeader('Thread-Topic', "P{$id}"); + ->setSubject("P{$id}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/phame/editor/PhameBlogEditor.php b/src/applications/phame/editor/PhameBlogEditor.php index f30a74065e..c122d8fa3b 100644 --- a/src/applications/phame/editor/PhameBlogEditor.php +++ b/src/applications/phame/editor/PhameBlogEditor.php @@ -48,12 +48,10 @@ final class PhameBlogEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $phid = $object->getPHID(); $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject($name) - ->addHeader('Thread-Topic', $phid); + ->setSubject($name); } protected function buildReplyHandler(PhabricatorLiskDAO $object) { diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php index 488d7a4938..d95389e549 100644 --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -61,12 +61,10 @@ final class PhamePostEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $phid = $object->getPHID(); $title = $object->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject($title) - ->addHeader('Thread-Topic', $phid); + ->setSubject($title); } protected function buildReplyHandler(PhabricatorLiskDAO $object) { diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index c0fcf31f83..6bd49d2e7b 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -112,11 +112,9 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); $name = $object->getName(); - $original_name = $object->getOriginalName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("M{$id}: {$name}") - ->addHeader('Thread-Topic', "M{$id}: {$original_name}"); + ->setSubject("M{$id}: {$name}"); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/phortune/editor/PhortuneCartEditor.php b/src/applications/phortune/editor/PhortuneCartEditor.php index 5196e12429..dcf1f2d0e0 100644 --- a/src/applications/phortune/editor/PhortuneCartEditor.php +++ b/src/applications/phortune/editor/PhortuneCartEditor.php @@ -123,8 +123,7 @@ final class PhortuneCartEditor $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject(pht('Order %d: %s', $id, $name)) - ->addHeader('Thread-Topic', pht('Order %s', $id)); + ->setSubject(pht('Order %d: %s', $id, $name)); } protected function buildMailBody( diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index fcc9fe0474..73aee3fd4c 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -299,12 +299,10 @@ final class PhrictionTransactionEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $id = $object->getID(); $title = $object->getContent()->getTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject($title) - ->addHeader('Thread-Topic', $object->getPHID()); + ->setSubject($title); } protected function buildMailBody( diff --git a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php index 439d62f84a..49f290c343 100644 --- a/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php +++ b/src/applications/phurl/editor/PhabricatorPhurlURLEditor.php @@ -68,8 +68,7 @@ final class PhabricatorPhurlURLEditor $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("U{$id}: {$name}") - ->addHeader('Thread-Topic', "U{$id}: ".$object->getName()); + ->setSubject("U{$id}: {$name}"); } protected function buildMailBody( diff --git a/src/applications/ponder/editor/PonderAnswerEditor.php b/src/applications/ponder/editor/PonderAnswerEditor.php index bab0e1f72d..37b2fe2cd0 100644 --- a/src/applications/ponder/editor/PonderAnswerEditor.php +++ b/src/applications/ponder/editor/PonderAnswerEditor.php @@ -57,8 +57,7 @@ final class PonderAnswerEditor extends PonderEditor { $id = $object->getID(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("ANSR{$id}") - ->addHeader('Thread-Topic', "ANSR{$id}"); + ->setSubject("ANSR{$id}"); } protected function buildMailBody( diff --git a/src/applications/ponder/editor/PonderQuestionEditor.php b/src/applications/ponder/editor/PonderQuestionEditor.php index 0720f436b9..ba9687bd0d 100644 --- a/src/applications/ponder/editor/PonderQuestionEditor.php +++ b/src/applications/ponder/editor/PonderQuestionEditor.php @@ -146,11 +146,9 @@ final class PonderQuestionEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); $title = $object->getTitle(); - $original_title = $object->getOriginalTitle(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("Q{$id}: {$title}") - ->addHeader('Thread-Topic', "Q{$id}: {$original_title}"); + ->setSubject("Q{$id}: {$title}"); } protected function buildMailBody( diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 2764ce6322..de61c2a09b 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -219,12 +219,10 @@ final class PhabricatorProjectTransactionEditor } protected function buildMailTemplate(PhabricatorLiskDAO $object) { - $id = $object->getID(); $name = $object->getName(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("{$name}") - ->addHeader('Thread-Topic', "Project {$id}"); + ->setSubject("{$name}"); } protected function buildMailBody( diff --git a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php index 4710557043..da488d9c72 100644 --- a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php +++ b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php @@ -196,11 +196,9 @@ final class ReleephRequestTransactionalEditor protected function buildMailTemplate(PhabricatorLiskDAO $object) { $id = $object->getID(); - $phid = $object->getPHID(); $title = $object->getSummaryForDisplay(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("RQ{$id}: {$title}") - ->addHeader('Thread-Topic', "RQ{$id}: {$phid}"); + ->setSubject("RQ{$id}: {$title}"); } protected function getMailTo(PhabricatorLiskDAO $object) { diff --git a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php index 17226a1377..5ffaf0a5c2 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php @@ -124,7 +124,6 @@ final class PhabricatorRepositoryPushMailWorker ->setFrom($event->getPusherPHID()) ->setBody($body->render()) ->setThreadID($event->getPHID(), $is_new = true) - ->addHeader('Thread-Topic', $subject) ->setIsBulk(true); return $target->willSendMail($mail); diff --git a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php index 38dbfb12d6..cf088f37d4 100644 --- a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php +++ b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php @@ -48,8 +48,7 @@ final class PhabricatorSlowvoteEditor $name = $object->getQuestion(); return id(new PhabricatorMetaMTAMail()) - ->setSubject("{$monogram}: {$name}") - ->addHeader('Thread-Topic', $monogram); + ->setSubject("{$monogram}: {$name}"); } protected function buildMailBody(