Differential D20957 Diff 49931 src/applications/diffusion/herald/DiffusionCommitCommitterPackagesHeraldField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/herald/DiffusionCommitCommitterPackagesHeraldField.php
- This file was copied from src/applications/diffusion/herald/DiffusionCommitAuthorProjectsHeraldField.php.
| <?php | <?php | ||||
| final class DiffusionCommitAuthorProjectsHeraldField | final class DiffusionCommitCommitterPackagesHeraldField | ||||
| extends DiffusionCommitHeraldField { | extends DiffusionCommitHeraldField { | ||||
| const FIELDCONST = 'diffusion.commit.author.projects'; | const FIELDCONST = 'diffusion.commit.committer.packages'; | ||||
| public function getHeraldFieldName() { | public function getHeraldFieldName() { | ||||
| return pht("Author's projects"); | return pht("Committer's packages"); | ||||
| } | } | ||||
| public function getHeraldFieldValue($object) { | public function getHeraldFieldValue($object) { | ||||
| $adapter = $this->getAdapter(); | $adapter = $this->getAdapter(); | ||||
| $viewer = $adapter->getViewer(); | $viewer = $adapter->getViewer(); | ||||
| $phid = $adapter->getAuthorPHID(); | $committer_phid = $adapter->getAuthorPHID(); | ||||
| if (!$phid) { | if (!$committer_phid) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| $projects = id(new PhabricatorProjectQuery()) | $packages = id(new PhabricatorOwnersPackageQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withMemberPHIDs(array($phid)) | ->withAuthorityPHIDs(array($committer_phid)) | ||||
| ->execute(); | ->execute(); | ||||
| return mpull($projects, 'getPHID'); | return mpull($packages, 'getPHID'); | ||||
| } | } | ||||
| protected function getHeraldFieldStandardType() { | protected function getHeraldFieldStandardType() { | ||||
| return self::STANDARD_PHID_LIST; | return self::STANDARD_PHID_LIST; | ||||
| } | } | ||||
| protected function getDatasource() { | protected function getDatasource() { | ||||
| return new PhabricatorProjectDatasource(); | return new PhabricatorOwnersPackageDatasource(); | ||||
| } | } | ||||
| } | } | ||||