@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<?php
2
3final class DiffusionPreCommitContentCommitterPackagesHeraldField
4 extends DiffusionPreCommitContentHeraldField {
5
6 const FIELDCONST = 'diffusion.pre.commit.committer.packages';
7
8 public function getHeraldFieldName() {
9 return pht("Committer's packages");
10 }
11
12 public function getHeraldFieldValue($object) {
13 $adapter = $this->getAdapter();
14 $viewer = $adapter->getViewer();
15
16 $committer_phid = $adapter->getCommitterPHID();
17 if (!$committer_phid) {
18 return array();
19 }
20
21 $packages = id(new PhabricatorOwnersPackageQuery())
22 ->setViewer($viewer)
23 ->withAuthorityPHIDs(array($committer_phid))
24 ->execute();
25
26 return mpull($packages, 'getPHID');
27 }
28
29 protected function getHeraldFieldStandardType() {
30 return self::STANDARD_PHID_LIST;
31 }
32
33 protected function getDatasource() {
34 return new PhabricatorOwnersPackageDatasource();
35 }
36
37}