@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 DiffusionPreCommitContentRevisionAcceptedHeraldField
4 extends DiffusionPreCommitContentHeraldField {
5
6 const FIELDCONST = 'diffusion.pre.content.revision.accepted';
7
8 public function getHeraldFieldName() {
9 return pht('Accepted Differential revision');
10 }
11
12 public function getFieldGroupKey() {
13 return HeraldRelatedFieldGroup::FIELDGROUPKEY;
14 }
15
16 public function getHeraldFieldValue($object) {
17 $revision = $this->getAdapter()->getRevision();
18 if (!$revision) {
19 return null;
20 }
21
22 if ($revision->isAccepted()) {
23 return $revision->getPHID();
24 }
25
26 $was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED;
27 if ($revision->isPublished()) {
28 if ($revision->getProperty($was_accepted)) {
29 return $revision->getPHID();
30 }
31 }
32
33 return null;
34 }
35
36 protected function getHeraldFieldStandardType() {
37 return self::STANDARD_PHID_BOOL;
38 }
39
40}