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

Implement an "Author's packages" Herald field for Differential

Summary: Ref T13480. Add an "Author's packages" field to Herald to support writing rules like "if affected packages include X, and author's packages do not include X, raise the alarm".

Test Plan: Wrote and executed rules with the field, saw a sensible field value in the transcript.

Maniphest Tasks: T13480

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

+34
+2
src/__phutil_library_map__.php
··· 603 603 'DifferentialRevisionActionTransaction' => 'applications/differential/xaction/DifferentialRevisionActionTransaction.php', 604 604 'DifferentialRevisionAffectedFilesHeraldField' => 'applications/differential/herald/DifferentialRevisionAffectedFilesHeraldField.php', 605 605 'DifferentialRevisionAuthorHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorHeraldField.php', 606 + 'DifferentialRevisionAuthorPackagesHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorPackagesHeraldField.php', 606 607 'DifferentialRevisionAuthorProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php', 607 608 'DifferentialRevisionBuildableTransaction' => 'applications/differential/xaction/DifferentialRevisionBuildableTransaction.php', 608 609 'DifferentialRevisionCloseDetailsController' => 'applications/differential/controller/DifferentialRevisionCloseDetailsController.php', ··· 6595 6596 'DifferentialRevisionActionTransaction' => 'DifferentialRevisionTransactionType', 6596 6597 'DifferentialRevisionAffectedFilesHeraldField' => 'DifferentialRevisionHeraldField', 6597 6598 'DifferentialRevisionAuthorHeraldField' => 'DifferentialRevisionHeraldField', 6599 + 'DifferentialRevisionAuthorPackagesHeraldField' => 'DifferentialRevisionHeraldField', 6598 6600 'DifferentialRevisionAuthorProjectsHeraldField' => 'DifferentialRevisionHeraldField', 6599 6601 'DifferentialRevisionBuildableTransaction' => 'DifferentialRevisionTransactionType', 6600 6602 'DifferentialRevisionCloseDetailsController' => 'DifferentialController',
+32
src/applications/differential/herald/DifferentialRevisionAuthorPackagesHeraldField.php
··· 1 + <?php 2 + 3 + final class DifferentialRevisionAuthorPackagesHeraldField 4 + extends DifferentialRevisionHeraldField { 5 + 6 + const FIELDCONST = 'differential.revision.author.packages'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht("Author's packages"); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + $adapter = $this->getAdapter(); 14 + $viewer = $adapter->getViewer(); 15 + 16 + $packages = id(new PhabricatorOwnersPackageQuery()) 17 + ->setViewer($viewer) 18 + ->withAuthorityPHIDs(array($object->getAuthorPHID())) 19 + ->execute(); 20 + 21 + return mpull($packages, 'getPHID'); 22 + } 23 + 24 + protected function getHeraldFieldStandardType() { 25 + return self::STANDARD_PHID_LIST; 26 + } 27 + 28 + protected function getDatasource() { 29 + return new PhabricatorOwnersPackageDatasource(); 30 + } 31 + 32 + }