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

Restore "Commandeer" action to Differential on EditEngine

Summary:
Ref T11114. This has two pieces of side-effect logic which I've noted locally:

- Commandeer needs to apply Herald rules.
- Commandeer needs to move the old author to become a reviewer and remove
the actor as a reviewer.

Test Plan: Commandeered some revisions.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+69
+2
src/__phutil_library_map__.php
··· 512 512 'DifferentialRevisionAuthorProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php', 513 513 'DifferentialRevisionCloseDetailsController' => 'applications/differential/controller/DifferentialRevisionCloseDetailsController.php', 514 514 'DifferentialRevisionCloseTransaction' => 'applications/differential/xaction/DifferentialRevisionCloseTransaction.php', 515 + 'DifferentialRevisionCommandeerTransaction' => 'applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php', 515 516 'DifferentialRevisionContentAddedHeraldField' => 'applications/differential/herald/DifferentialRevisionContentAddedHeraldField.php', 516 517 'DifferentialRevisionContentHeraldField' => 'applications/differential/herald/DifferentialRevisionContentHeraldField.php', 517 518 'DifferentialRevisionContentRemovedHeraldField' => 'applications/differential/herald/DifferentialRevisionContentRemovedHeraldField.php', ··· 5185 5186 'DifferentialRevisionAuthorProjectsHeraldField' => 'DifferentialRevisionHeraldField', 5186 5187 'DifferentialRevisionCloseDetailsController' => 'DifferentialController', 5187 5188 'DifferentialRevisionCloseTransaction' => 'DifferentialRevisionActionTransaction', 5189 + 'DifferentialRevisionCommandeerTransaction' => 'DifferentialRevisionActionTransaction', 5188 5190 'DifferentialRevisionContentAddedHeraldField' => 'DifferentialRevisionHeraldField', 5189 5191 'DifferentialRevisionContentHeraldField' => 'DifferentialRevisionHeraldField', 5190 5192 'DifferentialRevisionContentRemovedHeraldField' => 'DifferentialRevisionHeraldField',
+67
src/applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php
··· 1 + <?php 2 + 3 + final class DifferentialRevisionCommandeerTransaction 4 + extends DifferentialRevisionActionTransaction { 5 + 6 + const TRANSACTIONTYPE = 'differential.revision.commandeer'; 7 + const ACTIONKEY = 'commandeer'; 8 + 9 + protected function getRevisionActionLabel() { 10 + return pht('Commandeer Revision'); 11 + } 12 + 13 + protected function getRevisionActionDescription() { 14 + return pht('You will take control of this revision and become its author.'); 15 + } 16 + 17 + public function getIcon() { 18 + return 'fa-flag'; 19 + } 20 + 21 + public function getColor() { 22 + return 'sky'; 23 + } 24 + 25 + public function generateOldValue($object) { 26 + return $object->getAuthorPHID(); 27 + } 28 + 29 + public function generateNewValue($object, $value) { 30 + $actor = $this->getActor(); 31 + return $actor->getPHID(); 32 + } 33 + 34 + public function applyInternalEffects($object, $value) { 35 + $object->setAuthorPHID($value); 36 + } 37 + 38 + protected function validateAction($object, PhabricatorUser $viewer) { 39 + if ($object->isClosed()) { 40 + throw new Exception( 41 + pht( 42 + 'You can not commandeer this revision because it has already '. 43 + 'been closed. You can only commandeer open revisions.')); 44 + } 45 + 46 + if ($this->isViewerRevisionAuthor($object, $viewer)) { 47 + throw new Exception( 48 + pht( 49 + 'You can not commandeer this revision because you are already '. 50 + 'the author.')); 51 + } 52 + } 53 + 54 + public function getTitle() { 55 + return pht( 56 + '%s commandeered this revision.', 57 + $this->renderAuthor()); 58 + } 59 + 60 + public function getTitleForFeed() { 61 + return pht( 62 + '%s commandeered %s.', 63 + $this->renderAuthor(), 64 + $this->renderObject()); 65 + } 66 + 67 + }