@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.

Make Thread-Topic human readable

Summary:
Some e-mail clients display this header and it needs to be constant.

This is somehow involved but I doubt that there is a simpler solution.

Test Plan:
Applied SQL patch.
Commented on revision, commented on commit, changed package.
Verified that the `Thread-Topic` has constant and human readable value.

Reviewers: epriestley

Reviewed By: epriestley

CC: ola, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2745

vrana 892a2d1b 7463f9b3

+62 -10
+14
resources/sql/patches/threadtopic.sql
··· 1 + ALTER TABLE {$NAMESPACE}_differential.differential_revision 2 + ADD originalTitle varchar(255) NOT NULL AFTER title; 3 + UPDATE {$NAMESPACE}_differential.differential_revision SET 4 + originalTitle = title; 5 + 6 + ALTER TABLE {$NAMESPACE}_owners.owners_package 7 + ADD originalName varchar(255) NOT NULL AFTER name; 8 + UPDATE {$NAMESPACE}_owners.owners_package SET 9 + originalName = name; 10 + 11 + ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task 12 + ADD originalTitle text NOT NULL AFTER title; 13 + UPDATE {$NAMESPACE}_maniphest.maniphest_task SET 14 + originalTitle = title;
+9 -4
src/applications/audit/editor/PhabricatorAuditCommentEditor.php
··· 395 395 396 396 $prefix = PhabricatorEnv::getEnvConfig('metamta.diffusion.subject-prefix'); 397 397 398 - $threading = self::getMailThreading($commit->getPHID()); 398 + $repository = id(new PhabricatorRepository()) 399 + ->load($commit->getRepositoryID()); 400 + $threading = self::getMailThreading($repository, $commit); 399 401 list($thread_id, $thread_topic) = $threading; 400 402 401 403 $body = $this->renderMailBody( ··· 452 454 } 453 455 } 454 456 455 - public static function getMailThreading($phid) { 457 + public static function getMailThreading( 458 + PhabricatorRepository $repository, 459 + PhabricatorRepositoryCommit $commit) { 460 + 456 461 return array( 457 - 'diffusion-audit-'.$phid, 458 - 'Diffusion Audit '.$phid, 462 + 'diffusion-audit-'.$commit->getPHID(), 463 + 'Commit r'.$repository->getCallsign().$commit->getCommitIdentifier(), 459 464 ); 460 465 } 461 466
+3 -2
src/applications/differential/mail/DifferentialMail.php
··· 328 328 } 329 329 330 330 protected function getThreadTopic() { 331 - $phid = $this->getRevision()->getPHID(); 332 - return "Differential Revision {$phid}"; 331 + $id = $this->getRevision()->getID(); 332 + $title = $this->getRevision()->getOriginalTitle(); 333 + return "D{$id}: {$title}"; 333 334 } 334 335 335 336 public function setComment($comment) {
+9
src/applications/differential/storage/DifferentialRevision.php
··· 19 19 final class DifferentialRevision extends DifferentialDAO { 20 20 21 21 protected $title; 22 + protected $originalTitle; 22 23 protected $status; 23 24 24 25 protected $summary; ··· 58 59 'unsubscribed' => self::SERIALIZATION_JSON, 59 60 ), 60 61 ) + parent::getConfiguration(); 62 + } 63 + 64 + public function setTitle($title) { 65 + $this->title = $title; 66 + if (!$this->getID()) { 67 + $this->originalTitle = $title; 68 + } 69 + return $this; 61 70 } 62 71 63 72 public function loadCommitPHIDs() {
+1 -1
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 278 278 ->setVarySubjectPrefix("[{$action}]") 279 279 ->setFrom($transaction->getAuthorPHID()) 280 280 ->setParentMessageID($this->parentMessageID) 281 - ->addHeader('Thread-Topic', 'Maniphest Task '.$task->getPHID()) 281 + ->addHeader('Thread-Topic', "T{$task_id}: ".$task->getOriginalTitle()) 282 282 ->setThreadID($thread_id, $is_create) 283 283 ->setRelatedPHID($task->getPHID()) 284 284 ->setIsBulk(true)
+9
src/applications/maniphest/storage/ManiphestTask.php
··· 31 31 protected $subpriority; 32 32 33 33 protected $title; 34 + protected $originalTitle; 34 35 protected $description; 35 36 protected $originalEmailSource; 36 37 protected $mailKey; ··· 104 105 } 105 106 $this->auxiliaryAttributes[$key] = $val; 106 107 $this->auxiliaryDirty[$key] = true; 108 + return $this; 109 + } 110 + 111 + public function setTitle($title) { 112 + $this->title = $title; 113 + if (!$this->getID()) { 114 + $this->originalTitle = $title; 115 + } 107 116 return $this; 108 117 } 109 118
+2 -2
src/applications/owners/mail/PackageMail.php
··· 24 24 protected $paths; 25 25 protected $mailTo; 26 26 27 - public function __construct($package) { 27 + public function __construct(PhabricatorOwnersPackage $package) { 28 28 $this->package = $package; 29 29 } 30 30 ··· 206 206 private function getMailThreading() { 207 207 return array( 208 208 'package-'.$this->getPackage()->getPHID(), 209 - 'package '.$this->getPackage()->getPHID(), 209 + 'Package '.$this->getPackage()->getOriginalName(), 210 210 ); 211 211 } 212 212
+9
src/applications/owners/storage/PhabricatorOwnersPackage.php
··· 20 20 21 21 protected $phid; 22 22 protected $name; 23 + protected $originalName; 23 24 protected $auditingEnabled; 24 25 protected $description; 25 26 protected $primaryOwnerPHID; ··· 77 78 78 79 public function getOldAuditingEnabled() { 79 80 return $this->oldAuditingEnabled; 81 + } 82 + 83 + public function setName($name) { 84 + $this->name = $name; 85 + if (!$this->getID()) { 86 + $this->originalName = $name; 87 + } 88 + return $this; 80 89 } 81 90 82 91 public function loadOwners() {
+2 -1
src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
··· 153 153 $prefix = PhabricatorEnv::getEnvConfig('metamta.diffusion.subject-prefix'); 154 154 155 155 $threading = PhabricatorAuditCommentEditor::getMailThreading( 156 - $commit->getPHID()); 156 + $repository, 157 + $commit); 157 158 list($thread_id, $thread_topic) = $threading; 158 159 159 160 $template = new PhabricatorMetaMTAMail();
+4
src/infrastructure/setup/sql/PhabricatorBuiltinPatchList.php
··· 887 887 'type' => 'sql', 888 888 'name' => $this->getPatchPath('ldapinfo.sql'), 889 889 ), 890 + 'threadtopic.sql' => array( 891 + 'type' => 'sql', 892 + 'name' => $this->getPatchPath('threadtopic.sql'), 893 + ), 890 894 ); 891 895 } 892 896