mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 02:42:40 +01:00
de6349dd67
Summary: Ref T9838. Add a Properties field to Revision, and update a `wasAcceptedBeforeClose` when closing a revision. Test Plan: A quick run through the obvious steps (Close with commit/manually, with or w/o accept) and calling `differential.query` shows the `wasAcceptedBeforeClose` property was setup correctly. Pushing closed + accepted passes the relevant herald, which was my immediate issue; Pushing un-accepted is blocked. Test the "commit" rule (Different from "pre-commit") by hacking the DB and running the "has accepted revision" rule in a test-console. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T9838 Differential Revision: https://secure.phabricator.com/D15085
42 lines
1,007 B
PHP
42 lines
1,007 B
PHP
<?php
|
|
|
|
final class DiffusionPreCommitContentRevisionAcceptedHeraldField
|
|
extends DiffusionPreCommitContentHeraldField {
|
|
|
|
const FIELDCONST = 'diffusion.pre.content.revision.accepted';
|
|
|
|
public function getHeraldFieldName() {
|
|
return pht('Accepted Differential revision');
|
|
}
|
|
|
|
public function getFieldGroupKey() {
|
|
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
|
|
}
|
|
|
|
public function getHeraldFieldValue($object) {
|
|
$revision = $this->getAdapter()->getRevision();
|
|
|
|
if (!$revision) {
|
|
return null;
|
|
}
|
|
|
|
switch ($revision->getStatus()) {
|
|
case ArcanistDifferentialRevisionStatus::ACCEPTED:
|
|
return $revision->getPHID();
|
|
case ArcanistDifferentialRevisionStatus::CLOSED:
|
|
if ($revision->getProperty(
|
|
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
|
|
|
|
return $revision->getPHID();
|
|
}
|
|
break;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected function getHeraldFieldStandardType() {
|
|
return self::STANDARD_PHID_BOOL;
|
|
}
|
|
|
|
}
|