@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+31 -70
+1 -4
src/applications/audit/editor/PhabricatorAuditEditor.php
··· 473 473 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 474 474 $identifier = $object->getCommitIdentifier(); 475 475 $repository = $object->getRepository(); 476 - $monogram = $repository->getMonogram(); 477 476 478 477 $summary = $object->getSummary(); 479 478 $name = $repository->formatCommitName($identifier); 480 479 481 480 $subject = "{$name}: {$summary}"; 482 - $thread_topic = "Commit {$monogram}{$identifier}"; 483 481 484 482 $template = id(new PhabricatorMetaMTAMail()) 485 - ->setSubject($subject) 486 - ->addHeader('Thread-Topic', $thread_topic); 483 + ->setSubject($subject); 487 484 488 485 $this->attachPatch( 489 486 $template,
+1 -3
src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php
··· 255 255 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 256 256 $id = $object->getID(); 257 257 $name = $object->getName(); 258 - $phid = $object->getPHID(); 259 258 260 259 $mail = id(new PhabricatorMetaMTAMail()) 261 - ->setSubject(pht('SSH Key %d: %s', $id, $name)) 262 - ->addHeader('Thread-Topic', $phid); 260 + ->setSubject(pht('SSH Key %d: %s', $id, $name)); 263 261 264 262 // The primary value of this mail is alerting users to account compromises, 265 263 // so force delivery. In particular, this mail should still be delivered
+1 -3
src/applications/badges/editor/PhabricatorBadgesEditor.php
··· 87 87 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 88 88 $name = $object->getName(); 89 89 $id = $object->getID(); 90 - $topic = pht('Badge %d', $id); 91 90 $subject = pht('Badge %d: %s', $id, $name); 92 91 93 92 return id(new PhabricatorMetaMTAMail()) 94 - ->setSubject($subject) 95 - ->addHeader('Thread-Topic', $topic); 93 + ->setSubject($subject); 96 94 } 97 95 98 96 protected function getMailTo(PhabricatorLiskDAO $object) {
+1 -3
src/applications/calendar/editor/PhabricatorCalendarEventEditor.php
··· 309 309 } 310 310 311 311 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 312 - $id = $object->getID(); 313 312 $name = $object->getName(); 314 313 $monogram = $object->getMonogram(); 315 314 316 315 return id(new PhabricatorMetaMTAMail()) 317 - ->setSubject("{$monogram}: {$name}") 318 - ->addHeader('Thread-Topic', $monogram); 316 + ->setSubject("{$monogram}: {$name}"); 319 317 } 320 318 321 319 protected function buildMailBody(
+1 -3
src/applications/conpherence/editor/ConpherenceEditor.php
··· 227 227 '%s sent you a message.', 228 228 $this->getActor()->getUserName()); 229 229 } 230 - $phid = $object->getPHID(); 231 230 232 231 return id(new PhabricatorMetaMTAMail()) 233 - ->setSubject("Z{$id}: {$title}") 234 - ->addHeader('Thread-Topic', "Z{$id}: {$phid}"); 232 + ->setSubject("Z{$id}: {$title}"); 235 233 } 236 234 237 235 protected function getMailTo(PhabricatorLiskDAO $object) {
+1 -2
src/applications/countdown/editor/PhabricatorCountdownEditor.php
··· 45 45 $name = $object->getTitle(); 46 46 47 47 return id(new PhabricatorMetaMTAMail()) 48 - ->setSubject("{$monogram}: {$name}") 49 - ->addHeader('Thread-Topic', $monogram); 48 + ->setSubject("{$monogram}: {$name}"); 50 49 } 51 50 52 51 protected function buildMailBody(
+1 -6
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 689 689 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 690 690 $id = $object->getID(); 691 691 $title = $object->getTitle(); 692 - 693 - $original_title = $object->getOriginalTitle(); 694 - 695 692 $subject = "D{$id}: {$title}"; 696 - $thread_topic = "D{$id}: {$original_title}"; 697 693 698 694 return id(new PhabricatorMetaMTAMail()) 699 - ->setSubject($subject) 700 - ->addHeader('Thread-Topic', $thread_topic); 695 + ->setSubject($subject); 701 696 } 702 697 703 698 protected function getTransactionsForMail(
+1 -2
src/applications/files/editor/PhabricatorFileEditor.php
··· 47 47 $name = $object->getName(); 48 48 49 49 return id(new PhabricatorMetaMTAMail()) 50 - ->setSubject("F{$id}: {$name}") 51 - ->addHeader('Thread-Topic', "F{$id}"); 50 + ->setSubject("F{$id}: {$name}"); 52 51 } 53 52 54 53 protected function buildMailBody(
+1 -2
src/applications/fund/editor/FundInitiativeEditor.php
··· 50 50 $name = $object->getName(); 51 51 52 52 return id(new PhabricatorMetaMTAMail()) 53 - ->setSubject("{$monogram}: {$name}") 54 - ->addHeader('Thread-Topic', $monogram); 53 + ->setSubject("{$monogram}: {$name}"); 55 54 } 56 55 57 56 protected function buildMailBody(
+1 -3
src/applications/legalpad/editor/LegalpadDocumentEditor.php
··· 124 124 125 125 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 126 126 $id = $object->getID(); 127 - $phid = $object->getPHID(); 128 127 $title = $object->getDocumentBody()->getTitle(); 129 128 130 129 return id(new PhabricatorMetaMTAMail()) 131 - ->setSubject("L{$id}: {$title}") 132 - ->addHeader('Thread-Topic', "L{$id}: {$phid}"); 130 + ->setSubject("L{$id}: {$title}"); 133 131 } 134 132 135 133 protected function getMailTo(PhabricatorLiskDAO $object) {
+1 -2
src/applications/macro/editor/PhabricatorMacroEditor.php
··· 35 35 $name = 'Image Macro "'.$name.'"'; 36 36 37 37 return id(new PhabricatorMetaMTAMail()) 38 - ->setSubject($name) 39 - ->addHeader('Thread-Topic', $name); 38 + ->setSubject($name); 40 39 } 41 40 42 41 protected function getMailTo(PhabricatorLiskDAO $object) {
+1 -2
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 206 206 $title = $object->getTitle(); 207 207 208 208 return id(new PhabricatorMetaMTAMail()) 209 - ->setSubject("T{$id}: {$title}") 210 - ->addHeader('Thread-Topic', "T{$id}: ".$object->getOriginalTitle()); 209 + ->setSubject("T{$id}: {$title}"); 211 210 } 212 211 213 212 protected function buildMailBody(
+6
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 1262 1262 $headers[] = array('X-Phabricator-Must-Encrypt', 'Yes'); 1263 1263 } 1264 1264 1265 + $related_phid = $this->getRelatedPHID(); 1266 + if ($related_phid) { 1267 + $headers[] = array('Thread-Topic', $related_phid); 1268 + } 1269 + 1265 1270 return $headers; 1266 1271 } 1267 1272 ··· 1309 1314 'Precedence', 1310 1315 'References', 1311 1316 'Thread-Index', 1317 + 'Thread-Topic', 1312 1318 1313 1319 'X-Mail-Transport-Agent', 1314 1320 'X-Auto-Response-Suppress',
+1 -3
src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php
··· 46 46 } 47 47 48 48 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 49 - $id = $object->getID(); 50 49 $name = $object->getName(); 51 50 52 51 return id(new PhabricatorMetaMTAMail()) 53 - ->setSubject($name) 54 - ->addHeader('Thread-Topic', $object->getPHID()); 52 + ->setSubject($name); 55 53 } 56 54 57 55 protected function buildMailBody(
+1 -2
src/applications/paste/editor/PhabricatorPasteEditor.php
··· 72 72 $name = $object->getTitle(); 73 73 74 74 return id(new PhabricatorMetaMTAMail()) 75 - ->setSubject("P{$id}: {$name}") 76 - ->addHeader('Thread-Topic', "P{$id}"); 75 + ->setSubject("P{$id}: {$name}"); 77 76 } 78 77 79 78 protected function buildMailBody(
+1 -3
src/applications/phame/editor/PhameBlogEditor.php
··· 48 48 } 49 49 50 50 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 51 - $phid = $object->getPHID(); 52 51 $name = $object->getName(); 53 52 54 53 return id(new PhabricatorMetaMTAMail()) 55 - ->setSubject($name) 56 - ->addHeader('Thread-Topic', $phid); 54 + ->setSubject($name); 57 55 } 58 56 59 57 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
+1 -3
src/applications/phame/editor/PhamePostEditor.php
··· 61 61 } 62 62 63 63 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 64 - $phid = $object->getPHID(); 65 64 $title = $object->getTitle(); 66 65 67 66 return id(new PhabricatorMetaMTAMail()) 68 - ->setSubject($title) 69 - ->addHeader('Thread-Topic', $phid); 67 + ->setSubject($title); 70 68 } 71 69 72 70 protected function buildReplyHandler(PhabricatorLiskDAO $object) {
+1 -3
src/applications/pholio/editor/PholioMockEditor.php
··· 112 112 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 113 113 $id = $object->getID(); 114 114 $name = $object->getName(); 115 - $original_name = $object->getOriginalName(); 116 115 117 116 return id(new PhabricatorMetaMTAMail()) 118 - ->setSubject("M{$id}: {$name}") 119 - ->addHeader('Thread-Topic', "M{$id}: {$original_name}"); 117 + ->setSubject("M{$id}: {$name}"); 120 118 } 121 119 122 120 protected function getMailTo(PhabricatorLiskDAO $object) {
+1 -2
src/applications/phortune/editor/PhortuneCartEditor.php
··· 123 123 $name = $object->getName(); 124 124 125 125 return id(new PhabricatorMetaMTAMail()) 126 - ->setSubject(pht('Order %d: %s', $id, $name)) 127 - ->addHeader('Thread-Topic', pht('Order %s', $id)); 126 + ->setSubject(pht('Order %d: %s', $id, $name)); 128 127 } 129 128 130 129 protected function buildMailBody(
+1 -3
src/applications/phriction/editor/PhrictionTransactionEditor.php
··· 299 299 } 300 300 301 301 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 302 - $id = $object->getID(); 303 302 $title = $object->getContent()->getTitle(); 304 303 305 304 return id(new PhabricatorMetaMTAMail()) 306 - ->setSubject($title) 307 - ->addHeader('Thread-Topic', $object->getPHID()); 305 + ->setSubject($title); 308 306 } 309 307 310 308 protected function buildMailBody(
+1 -2
src/applications/phurl/editor/PhabricatorPhurlURLEditor.php
··· 68 68 $name = $object->getName(); 69 69 70 70 return id(new PhabricatorMetaMTAMail()) 71 - ->setSubject("U{$id}: {$name}") 72 - ->addHeader('Thread-Topic', "U{$id}: ".$object->getName()); 71 + ->setSubject("U{$id}: {$name}"); 73 72 } 74 73 75 74 protected function buildMailBody(
+1 -2
src/applications/ponder/editor/PonderAnswerEditor.php
··· 57 57 $id = $object->getID(); 58 58 59 59 return id(new PhabricatorMetaMTAMail()) 60 - ->setSubject("ANSR{$id}") 61 - ->addHeader('Thread-Topic', "ANSR{$id}"); 60 + ->setSubject("ANSR{$id}"); 62 61 } 63 62 64 63 protected function buildMailBody(
+1 -3
src/applications/ponder/editor/PonderQuestionEditor.php
··· 146 146 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 147 147 $id = $object->getID(); 148 148 $title = $object->getTitle(); 149 - $original_title = $object->getOriginalTitle(); 150 149 151 150 return id(new PhabricatorMetaMTAMail()) 152 - ->setSubject("Q{$id}: {$title}") 153 - ->addHeader('Thread-Topic', "Q{$id}: {$original_title}"); 151 + ->setSubject("Q{$id}: {$title}"); 154 152 } 155 153 156 154 protected function buildMailBody(
+1 -3
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 219 219 } 220 220 221 221 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 222 - $id = $object->getID(); 223 222 $name = $object->getName(); 224 223 225 224 return id(new PhabricatorMetaMTAMail()) 226 - ->setSubject("{$name}") 227 - ->addHeader('Thread-Topic', "Project {$id}"); 225 + ->setSubject("{$name}"); 228 226 } 229 227 230 228 protected function buildMailBody(
+1 -3
src/applications/releeph/editor/ReleephRequestTransactionalEditor.php
··· 196 196 197 197 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 198 198 $id = $object->getID(); 199 - $phid = $object->getPHID(); 200 199 $title = $object->getSummaryForDisplay(); 201 200 return id(new PhabricatorMetaMTAMail()) 202 - ->setSubject("RQ{$id}: {$title}") 203 - ->addHeader('Thread-Topic', "RQ{$id}: {$phid}"); 201 + ->setSubject("RQ{$id}: {$title}"); 204 202 } 205 203 206 204 protected function getMailTo(PhabricatorLiskDAO $object) {
-1
src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php
··· 124 124 ->setFrom($event->getPusherPHID()) 125 125 ->setBody($body->render()) 126 126 ->setThreadID($event->getPHID(), $is_new = true) 127 - ->addHeader('Thread-Topic', $subject) 128 127 ->setIsBulk(true); 129 128 130 129 return $target->willSendMail($mail);
+1 -2
src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php
··· 48 48 $name = $object->getQuestion(); 49 49 50 50 return id(new PhabricatorMetaMTAMail()) 51 - ->setSubject("{$monogram}: {$name}") 52 - ->addHeader('Thread-Topic', $monogram); 51 + ->setSubject("{$monogram}: {$name}"); 53 52 } 54 53 55 54 protected function buildMailBody(