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

Partially decouple revision broadcasting from revision draft state

Summary:
Depends on D19283. Ref T13110. To enable "Changes Planned + But, Still A Draft" and "Abandoned + But, Never Promoted From Draft" states, decouple the "broadcast" flag from the "draft" state.

Broadcast behavior is now based only on the `shouldBroadcast` flag, and revisions in any state may have this flag.

Revisions gain this flag when created as a non-draft, or when they leave the draft state for the first time.

There are probably still some ways you can get the wrong result here -- maybe abandon + update -- but those can be cleaned up as they arise.

Test Plan: Kinda poked it a bit but I'll vet this more heavily at the end of this sequence.

Maniphest Tasks: T13110

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

+12 -11
+5 -9
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 10 10 private $hasReviewTransaction = false; 11 11 private $affectedPaths; 12 12 private $firstBroadcast = false; 13 - private $wasDraft = false; 13 + private $wasBroadcasting; 14 14 15 15 public function getEditorApplicationClass() { 16 16 return 'PhabricatorDifferentialApplication'; ··· 137 137 } 138 138 } 139 139 140 - $this->wasDraft = $object->isDraft(); 140 + $this->wasBroadcasting = $object->getShouldBroadcast(); 141 141 142 142 return parent::expandTransactions($object, $xactions); 143 143 } ··· 1594 1594 // email so the mail gets enriched with "SUMMARY" and "TEST PLAN". 1595 1595 1596 1596 $is_new = $this->getIsNewObject(); 1597 - $was_draft = $this->wasDraft; 1597 + $was_broadcasting = $this->wasBroadcasting; 1598 1598 1599 - if (!$object->isDraft() && ($was_draft || $is_new)) { 1600 - if (!$object->getShouldBroadcast()) { 1599 + if ($object->getShouldBroadcast()) { 1600 + if (!$was_broadcasting || $is_new) { 1601 1601 // Mark this as the first broadcast we're sending about the revision 1602 1602 // so mail can generate specially. 1603 1603 $this->firstBroadcast = true; 1604 - 1605 - $object 1606 - ->setShouldBroadcast(true) 1607 - ->save(); 1608 1604 } 1609 1605 } 1610 1606
+4 -1
src/applications/differential/storage/DifferentialRevision.php
··· 75 75 76 76 if (PhabricatorEnv::getEnvConfig('phabricator.show-prototypes')) { 77 77 $initial_state = DifferentialRevisionStatus::DRAFT; 78 + $should_broadcast = false; 78 79 } else { 79 80 $initial_state = DifferentialRevisionStatus::NEEDS_REVIEW; 81 + $should_broadcast = true; 80 82 } 81 83 82 84 return id(new DifferentialRevision()) ··· 85 87 ->attachRepository(null) 86 88 ->attachActiveDiff(null) 87 89 ->attachReviewers(array()) 88 - ->setModernRevisionStatus($initial_state); 90 + ->setModernRevisionStatus($initial_state) 91 + ->setShouldBroadcast($should_broadcast); 89 92 } 90 93 91 94 protected function getConfiguration() {
+3 -1
src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
··· 37 37 38 38 public function applyInternalEffects($object, $value) { 39 39 $status_review = DifferentialRevisionStatus::NEEDS_REVIEW; 40 - $object->setModernRevisionStatus($status_review); 40 + $object 41 + ->setModernRevisionStatus($status_review) 42 + ->setShouldBroadcast(true); 41 43 } 42 44 43 45 protected function validateAction($object, PhabricatorUser $viewer) {