Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / herald / DiffusionCommitWrongBuildsHeraldField.php
blobea44f060394748fa82bd183a2f4451e490a800c3
1 <?php
3 final class DiffusionCommitWrongBuildsHeraldField
4 extends DiffusionCommitHeraldField {
6 const FIELDCONST = 'diffusion.commit.builds.wrong';
8 public function getHeraldFieldName() {
9 return pht('Revision has build warning');
12 public function getFieldGroupKey() {
13 return HeraldRelatedFieldGroup::FIELDGROUPKEY;
16 public function getHeraldFieldValue($object) {
17 $adapter = $this->getAdapter();
18 $viewer = $adapter->getViewer();
20 $revision = $adapter->loadDifferentialRevision();
21 if (!$revision) {
22 return false;
25 if ($revision->isPublished()) {
26 $wrong_builds = DifferentialRevision::PROPERTY_WRONG_BUILDS;
27 return !$revision->getProperty($wrong_builds, false);
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();
37 $concerning = DifferentialDiffExtractionEngine::loadConcerningBuilds(
38 $viewer,
39 $revision,
40 $strict = false);
42 return (bool)$concerning;
45 protected function getHeraldFieldStandardType() {
46 return self::STANDARD_BOOL;