mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +01:00
Use object PHIDs for "Thread-Topic" headers in mail
Summary: Depends on D19009. Ref T13053. For "Must Encrypt" mail, we must currently strip the "Thread-Topic" header because it sometimes contains sensitive information about the object. I don't actually know if this header is useful or anyting uses it. My understanding is that it's an Outlook/Exchange thing, but we also implement "Thread-Index" which I think is what Outlook/Exchange actually look at. This header may have done something before we implemented "Thread-Index", or maybe never done anything. Or maybe older versions of Excel/Outlook did something with it and newer versions don't, or do less. So it's possible that an even better fix here would be to simply remove this, but I wasn't able to convince myself of that after Googling for 10 minutes and I don't think it's worth hours of installing Exchange/Outlook to figure out. Instead, I'm just trying to simplify our handling of this header for now, and maybe some day we'll learn more about Exchange/Outlook and can remove it. In a number of cases we already use the object monogram or PHID as a "Thread-Topic" without users ever complaining, so I think that if this header is useful it probably isn't shown to users, or isn't shown very often (e.g., only in a specific "conversation" sub-view?). Just use the object PHID (which should be unique and stable) as a thread-topic, everywhere, automatically. Then allow this header through for "Must Encrypt" mail. Test Plan: Processed some local mail, saw object PHIDs for "Thread-Topic" headers. Reviewers: amckinley Maniphest Tasks: T13053 Differential Revision: https://secure.phabricator.com/D19012
This commit is contained in:
parent
19b3fb8863
commit
f090fa7426
27 changed files with 31 additions and 70 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue