mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
[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
This commit is contained in:
parent
1c2222f26f
commit
846d625ed0
2 changed files with 9 additions and 4 deletions
|
@ -45,9 +45,12 @@ class DifferentialCommentMail extends DifferentialMail {
|
|||
}
|
||||
|
||||
protected function renderSubject() {
|
||||
$verb = ucwords($this->getVerb());
|
||||
$revision = $this->getRevision();
|
||||
$verb = $this->getVerb();
|
||||
return ucwords($verb).': '.$revision->getTitle();
|
||||
$title = $revision->getTitle();
|
||||
$id = $revision->getID();
|
||||
$subject = "[{$verb}] D{$id}: {$title}";
|
||||
return $subject;
|
||||
}
|
||||
|
||||
protected function getVerb() {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
class ManiphestTransactionEditor {
|
||||
const SUBJECT_PREFIX = '[Maniphest]';
|
||||
|
||||
public function applyTransactions($task, array $transactions) {
|
||||
|
||||
|
@ -174,10 +175,11 @@ class ManiphestTransactionEditor {
|
|||
" ".$task_uri."\n";
|
||||
|
||||
$thread_id = '<maniphest-task-'.$task->getPHID().'>';
|
||||
$task_id = $task->getID();
|
||||
$title = $task->getTitle();
|
||||
|
||||
id(new PhabricatorMetaMTAMail())
|
||||
->setSubject(
|
||||
'[Maniphest] T'.$task->getID().' '.$action.': '.$task->getTitle())
|
||||
->setSubject(self::SUBJECT_PREFIX." [{$action}] T{$task_id}: {$title}")
|
||||
->setFrom($transaction->getAuthorPHID())
|
||||
->addTos($email_to)
|
||||
->addCCs($email_cc)
|
||||
|
|
Loading…
Reference in a new issue