Commit 5e073588 authored by epriestley's avatar epriestley
Browse files

Preserve "Autoclose?" information on new Commit edit flow

Summary: Ref T10978. The current "Edit" flow has some autoclose info. This isn't necessarily the best place to put it in the long run, but preseve it for now since the documentation refers to it.

Test Plan: {F2340658}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10978

Differential Revision: https://secure.phabricator.com/D17176
parent a27c824d
......@@ -30,7 +30,8 @@ final class DiffusionCommitEditEngine
}
protected function newObjectQuery() {
return new DiffusionCommitQuery();
return id(new DiffusionCommitQuery())
->needCommitData(true);
}
protected function getObjectCreateTitleText($object) {
......@@ -63,8 +64,49 @@ final class DiffusionCommitEditEngine
protected function buildCustomEditFields($object) {
$viewer = $this->getViewer();
return array();
$data = $object->getCommitData();
$fields = array();
$reason = $data->getCommitDetail('autocloseReason', false);
$reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
if ($reason !== false) {
switch ($reason) {
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
$desc = pht('No, Repository Importing');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
$desc = pht('No, Autoclose Disabled');
break;
case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
$desc = pht('No, Not On Autoclose Branch');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
$desc = pht('Yes, Forced Via bin/repository CLI Tool.');
break;
case null:
$desc = pht('Yes');
break;
default:
$desc = pht('Unknown');
break;
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
$doc_link = phutil_tag(
'a',
array(
'href' => $doc_href,
'target' => '_blank',
),
pht('Learn More'));
$fields[] = id(new PhabricatorStaticEditField())
->setLabel(pht('Autoclose?'))
->setValue(array($desc, " \xC2\xB7 ", $doc_link));
}
return $fields;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment