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

[differential] gmail-compatible emails

Summary:
Gmail ignores text inside of [square brackets] when deciding what to group
together. This diff does two things to create the right behavior for gmail:

1. put the verb text inside of [square brackets] so different verbs don't
break gmail threading.
2. Add the Diff ID to the email thread, so different diffs with the same name
don't group together.

Furthermore, to aid in distinguishing who is doing what when the from field
can't be spoofed, this diff adds the usename just before the verb. This works
quite well in the english language. For example:

[Differential] [rm requested a review of] D1: [admin] Create arcconfig for
code reviews
[Differential] [rm commented on] D1: [admin] Create arcconfig for code reviews

It's almost like a complete sentence. All it's missing is a period.

Test Plan:
Did it live on my test setup. Received emails with subjects that looked right.
Verified that gmail grouped the emails despite the different actions taking
place (tested: comments, planned changes, request review).

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley, rm
Differential Revision: 251

+9 -4
+5 -2
src/applications/differential/mail/comment/DifferentialCommentMail.php
··· 45 45 } 46 46 47 47 protected function renderSubject() { 48 + $verb = ucwords($this->getVerb()); 48 49 $revision = $this->getRevision(); 49 - $verb = $this->getVerb(); 50 - return ucwords($verb).': '.$revision->getTitle(); 50 + $title = $revision->getTitle(); 51 + $id = $revision->getID(); 52 + $subject = "[{$verb}] D{$id}: {$title}"; 53 + return $subject; 51 54 } 52 55 53 56 protected function getVerb() {
+4 -2
src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php
··· 17 17 */ 18 18 19 19 class ManiphestTransactionEditor { 20 + const SUBJECT_PREFIX = '[Maniphest]'; 20 21 21 22 public function applyTransactions($task, array $transactions) { 22 23 ··· 174 175 " ".$task_uri."\n"; 175 176 176 177 $thread_id = '<maniphest-task-'.$task->getPHID().'>'; 178 + $task_id = $task->getID(); 179 + $title = $task->getTitle(); 177 180 178 181 id(new PhabricatorMetaMTAMail()) 179 - ->setSubject( 180 - '[Maniphest] T'.$task->getID().' '.$action.': '.$task->getTitle()) 182 + ->setSubject(self::SUBJECT_PREFIX." [{$action}] T{$task_id}: {$title}") 181 183 ->setFrom($transaction->getAuthorPHID()) 182 184 ->addTos($email_to) 183 185 ->addCCs($email_cc)