@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 49 lines 1.2 kB view raw
1<?php 2 3final class DiffusionPreCommitContentWrongBuildsHeraldField 4 extends DiffusionPreCommitContentHeraldField { 5 6 const FIELDCONST = 'diffusion.pre.content.builds.wrong'; 7 8 public function getHeraldFieldName() { 9 return pht('Revision has build warning'); 10 } 11 12 public function getFieldGroupKey() { 13 return HeraldRelatedFieldGroup::FIELDGROUPKEY; 14 } 15 16 public function getHeraldFieldValue($object) { 17 $adapter = $this->getAdapter(); 18 $viewer = $adapter->getViewer(); 19 20 $revision = $adapter->getRevision(); 21 if (!$revision) { 22 return false; 23 } 24 25 if ($revision->isPublished()) { 26 $wrong_builds = DifferentialRevision::PROPERTY_WRONG_BUILDS; 27 return !$revision->getProperty($wrong_builds, false); 28 } 29 30 // Reload the revision to pick up active diffs. 31 $revision = id(new DifferentialRevisionQuery()) 32 ->setViewer($viewer) 33 ->withPHIDs(array($revision->getPHID())) 34 ->needActiveDiffs(true) 35 ->executeOne(); 36 37 $concerning = DifferentialDiffExtractionEngine::loadConcerningBuilds( 38 $viewer, 39 $revision, 40 $strict = true); 41 42 return (bool)$concerning; 43 } 44 45 protected function getHeraldFieldStandardType() { 46 return self::STANDARD_BOOL; 47 } 48 49}