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

Always use the same set of transactions to generate mail and mail tags

Summary:
See PHI307. Currently, when reviews undraft, we retroactively add in older activity to the mail ("alice created this revision...").

However, we don't add that activity to the mail tags, so the relevant tags (like "revision created") are dropped forever.

Instead, use the same set of transactions for both mail body and mail tag construction.

This should be obsoleted in the relatively near future by T10448, but it's a better/more correct behavior in general and we probably can't get rid of tags completely for a while.

Test Plan:
Applied patch, created a revision with builds, saw it auto-undraft after builds finished. Used `bin/mail list-outbound` and `bin/mail show-outbound` to see the mail. Verified that it included retroactive text ("created this revision") AND retroactive tags.

Note that the tag for "A new revision is created" is `DifferentialTransaction::MAILTAG_REVIEW_REQUEST` with literal value `differential-review-request`.

Reviewers: amckinley

Reviewed By: amckinley

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

+23 -9
+11 -5
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 700 700 ->addHeader('Thread-Topic', $thread_topic); 701 701 } 702 702 703 - protected function buildMailBody( 703 + protected function getTransactionsForMail( 704 704 PhabricatorLiskDAO $object, 705 705 array $xactions) { 706 - 707 - $viewer = $this->requireActor(); 708 - 709 706 // If this is the first time we're sending mail about this revision, we 710 707 // generate mail for all prior transactions, not just whatever is being 711 708 // applied now. This gets the "added reviewers" lines and other relevant 712 709 // information into the mail. 713 710 if ($this->isFirstBroadcast()) { 714 - $xactions = $this->loadUnbroadcastTransactions($object); 711 + return $this->loadUnbroadcastTransactions($object); 715 712 } 713 + 714 + return $xactions; 715 + } 716 + 717 + protected function buildMailBody( 718 + PhabricatorLiskDAO $object, 719 + array $xactions) { 720 + 721 + $viewer = $this->requireActor(); 716 722 717 723 $body = new PhabricatorMetaMTAMailBody(); 718 724 $body->setViewer($this->requireActor());
+12 -4
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 2546 2546 return $messages; 2547 2547 } 2548 2548 2549 + protected function getTransactionsForMail( 2550 + PhabricatorLiskDAO $object, 2551 + array $xactions) { 2552 + return $xactions; 2553 + } 2554 + 2549 2555 private function buildMailForTarget( 2550 2556 PhabricatorLiskDAO $object, 2551 2557 array $xactions, ··· 2566 2572 return null; 2567 2573 } 2568 2574 2575 + $mail_xactions = $this->getTransactionsForMail($object, $xactions); 2576 + 2569 2577 $mail = $this->buildMailTemplate($object); 2570 - $body = $this->buildMailBody($object, $xactions); 2578 + $body = $this->buildMailBody($object, $mail_xactions); 2571 2579 2572 - $mail_tags = $this->getMailTags($object, $xactions); 2573 - $action = $this->getMailAction($object, $xactions); 2580 + $mail_tags = $this->getMailTags($object, $mail_xactions); 2581 + $action = $this->getMailAction($object, $mail_xactions); 2574 2582 2575 2583 if (PhabricatorEnv::getEnvConfig('metamta.email-preferences')) { 2576 2584 $this->addEmailPreferenceSectionToMailBody( 2577 2585 $body, 2578 2586 $object, 2579 - $xactions); 2587 + $mail_xactions); 2580 2588 } 2581 2589 2582 2590 $mail