@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
at recaptime-dev/main 37 lines 838 B view raw
1<?php 2 3final class DiffusionCommitAuthorProjectsHeraldField 4 extends DiffusionCommitHeraldField { 5 6 const FIELDCONST = 'diffusion.commit.author.projects'; 7 8 public function getHeraldFieldName() { 9 return pht("Author's projects"); 10 } 11 12 public function getHeraldFieldValue($object) { 13 $adapter = $this->getAdapter(); 14 $viewer = $adapter->getViewer(); 15 16 $author_phid = $adapter->getAuthorPHID(); 17 if (!$author_phid) { 18 return array(); 19 } 20 21 $projects = id(new PhabricatorProjectQuery()) 22 ->setViewer($viewer) 23 ->withMemberPHIDs(array($author_phid)) 24 ->execute(); 25 26 return mpull($projects, 'getPHID'); 27 } 28 29 protected function getHeraldFieldStandardType() { 30 return self::STANDARD_PHID_LIST; 31 } 32 33 protected function getDatasource() { 34 return new PhabricatorProjectDatasource(); 35 } 36 37}