2015-07-07 11:53:17 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionCommitRevisionAcceptedHeraldField
|
|
|
|
extends DiffusionCommitHeraldField {
|
|
|
|
|
|
|
|
const FIELDCONST = 'diffusion.commit.revision.accepted';
|
|
|
|
|
|
|
|
public function getHeraldFieldName() {
|
|
|
|
return pht('Accepted Differential revision');
|
|
|
|
}
|
|
|
|
|
2015-07-16 14:13:13 -07:00
|
|
|
public function getFieldGroupKey() {
|
|
|
|
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
|
|
|
|
}
|
|
|
|
|
2015-07-07 11:53:17 -07:00
|
|
|
public function getHeraldFieldValue($object) {
|
|
|
|
$revision = $this->getAdapter()->loadDifferentialRevision();
|
|
|
|
if (!$revision) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = $object->getCommitData();
|
|
|
|
$status = $data->getCommitDetail(
|
|
|
|
'precommitRevisionStatus',
|
|
|
|
$revision->getStatus());
|
|
|
|
|
|
|
|
switch ($status) {
|
|
|
|
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
|
|
|
case ArcanistDifferentialRevisionStatus::CLOSED:
|
|
|
|
return $revision->getPHID();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-07-16 14:11:44 -07:00
|
|
|
protected function getHeraldFieldStandardType() {
|
2015-07-07 11:53:17 -07:00
|
|
|
return self::STANDARD_PHID_BOOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|