mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
In repository settings, fold "Autoclose On/Off" into "Publishing On/Off"
Summary: Depends on D20423. Ref T13277. Repositories currently have separate toggles for "Autoclose" and "Publishing". Merge the "Autoclose" toggle into the "Publishing" toggle. I'm unaware of any valid use case for enabling one but not the other. (This doesn't fix all the documentation, yet.) Test Plan: Edited a repository, saw only one publishing option. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13277 Differential Revision: https://secure.phabricator.com/D20424
This commit is contained in:
parent
c7b2553ca0
commit
ec9237fe13
9 changed files with 46 additions and 100 deletions
|
@ -935,7 +935,6 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefTableController' => 'applications/diffusion/controller/DiffusionRefTableController.php',
|
||||
'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php',
|
||||
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
||||
'DiffusionRepositoryActionsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php',
|
||||
'DiffusionRepositoryAutomationManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php',
|
||||
'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php',
|
||||
'DiffusionRepositoryBranchesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php',
|
||||
|
@ -970,6 +969,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
||||
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
|
||||
'DiffusionRepositoryProfilePictureController' => 'applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php',
|
||||
'DiffusionRepositoryPublishingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPublishingManagementPanel.php',
|
||||
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
||||
'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php',
|
||||
'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php',
|
||||
|
@ -4322,7 +4322,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryActivateTransaction' => 'applications/repository/xaction/PhabricatorRepositoryActivateTransaction.php',
|
||||
'PhabricatorRepositoryAuditRequest' => 'applications/repository/storage/PhabricatorRepositoryAuditRequest.php',
|
||||
'PhabricatorRepositoryAutocloseOnlyTransaction' => 'applications/repository/xaction/PhabricatorRepositoryAutocloseOnlyTransaction.php',
|
||||
'PhabricatorRepositoryAutocloseTransaction' => 'applications/repository/xaction/PhabricatorRepositoryAutocloseTransaction.php',
|
||||
'PhabricatorRepositoryBlueprintsTransaction' => 'applications/repository/xaction/PhabricatorRepositoryBlueprintsTransaction.php',
|
||||
'PhabricatorRepositoryBranch' => 'applications/repository/storage/PhabricatorRepositoryBranch.php',
|
||||
'PhabricatorRepositoryCallsignTransaction' => 'applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php',
|
||||
|
@ -6588,7 +6587,6 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefTableController' => 'DiffusionController',
|
||||
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
||||
'DiffusionRenameHistoryQuery' => 'Phobject',
|
||||
'DiffusionRepositoryActionsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryBranchesManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
|
@ -6622,6 +6620,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryPath' => 'Phobject',
|
||||
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryProfilePictureController' => 'DiffusionController',
|
||||
'DiffusionRepositoryPublishingManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryRef' => 'Phobject',
|
||||
'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
||||
|
@ -10555,7 +10554,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
'PhabricatorRepositoryAutocloseOnlyTransaction' => 'PhabricatorRepositoryTransactionType',
|
||||
'PhabricatorRepositoryAutocloseTransaction' => 'PhabricatorRepositoryTransactionType',
|
||||
'PhabricatorRepositoryBlueprintsTransaction' => 'PhabricatorRepositoryTransactionType',
|
||||
'PhabricatorRepositoryBranch' => 'PhabricatorRepositoryDAO',
|
||||
'PhabricatorRepositoryCallsignTransaction' => 'PhabricatorRepositoryTransactionType',
|
||||
|
|
|
@ -120,10 +120,10 @@ final class DiffusionCommitEditEngine
|
|||
$desc = pht('No, Repository Importing');
|
||||
break;
|
||||
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
|
||||
$desc = pht('No, Autoclose Disabled');
|
||||
$desc = pht('No, Repository Publishing Disabled');
|
||||
break;
|
||||
case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
|
||||
$desc = pht('No, Not On Autoclose Branch');
|
||||
$desc = pht('No, Not Reachable from Permanent Ref');
|
||||
break;
|
||||
case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
|
||||
$desc = pht('Yes, Forced Via bin/repository CLI Tool.');
|
||||
|
|
|
@ -468,20 +468,7 @@ final class DiffusionRepositoryEditEngine
|
|||
->setDescription(pht('Configure how changes are published.'))
|
||||
->setConduitDescription(pht('Change publishing options.'))
|
||||
->setConduitTypeDescription(pht('New notification setting.'))
|
||||
->setValue(!$object->getDetail('herald-disabled')),
|
||||
id(new PhabricatorBoolEditField())
|
||||
->setKey('autoclose')
|
||||
->setLabel(pht('Autoclose'))
|
||||
->setTransactionType(
|
||||
PhabricatorRepositoryAutocloseTransaction::TRANSACTIONTYPE)
|
||||
->setIsCopyable(true)
|
||||
->setOptions(
|
||||
pht('Disable Autoclose'),
|
||||
pht('Enable Autoclose'))
|
||||
->setDescription(pht('Stop or resume autoclosing in this repository.'))
|
||||
->setConduitDescription(pht('Change autoclose setting.'))
|
||||
->setConduitTypeDescription(pht('New autoclose setting.'))
|
||||
->setValue(!$object->getDetail('disable-autoclose')),
|
||||
->setValue(!$object->isPublishingDisabled()),
|
||||
id(new PhabricatorPolicyEditField())
|
||||
->setKey('policy.push')
|
||||
->setLabel(pht('Push Policy'))
|
||||
|
|
|
@ -96,24 +96,23 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
phutil_tag('em', array(), pht('Track All Branches')));
|
||||
$view->addProperty(pht('Track Only'), $track_only);
|
||||
|
||||
$autoclose_rules = $repository->getAutocloseOnlyRules();
|
||||
$autoclose_rules = implode(', ', $autoclose_rules);
|
||||
$autoclose_only = nonempty(
|
||||
$autoclose_rules,
|
||||
phutil_tag('em', array(), pht('All Branches')));
|
||||
|
||||
$autoclose_disabled = false;
|
||||
if ($repository->getDetail('disable-autoclose')) {
|
||||
$autoclose_disabled = true;
|
||||
$autoclose_only =
|
||||
phutil_tag('em', array(), pht('Autoclose has been disabled'));
|
||||
$publishing_disabled = $repository->isPublishingDisabled();
|
||||
if ($publishing_disabled) {
|
||||
$permanent_display =
|
||||
phutil_tag('em', array(), pht('Publishing Disabled'));
|
||||
} else {
|
||||
$permanent_rules = $repository->getAutocloseOnlyRules();
|
||||
if ($permanent_rules) {
|
||||
$permanent_display = implode(', ', $permanent_rules);
|
||||
} else {
|
||||
$permanent_display = phutil_tag('em', array(), pht('All Branches'));
|
||||
}
|
||||
}
|
||||
|
||||
$view->addProperty(pht('Permanent Refs'), $autoclose_only);
|
||||
$view->addProperty(pht('Permanent Refs'), $permanent_display);
|
||||
|
||||
$content[] = $this->newBox(pht('Branches'), $view);
|
||||
|
||||
// Branch Autoclose Table
|
||||
if (!$repository->isImporting()) {
|
||||
$request = $this->getRequest();
|
||||
$pager = id(new PHUIPagerView())
|
||||
|
@ -153,10 +152,14 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
$status = pht('Open');
|
||||
}
|
||||
|
||||
if ($autoclose_disabled) {
|
||||
$autoclose_status = pht('Disabled (Repository)');
|
||||
if ($publishing_disabled) {
|
||||
$permanent_status = pht('Publishing Disabled');
|
||||
} else {
|
||||
$autoclose_status = pht('Not Permanent');
|
||||
if ($permanent) {
|
||||
$permanent_status = pht('Permanent');
|
||||
} else {
|
||||
$permanent_status = pht('Not Permanent');
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
|
@ -164,7 +167,7 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
$branch_name,
|
||||
$status,
|
||||
$tracking ? pht('Tracking') : pht('Off'),
|
||||
$permanent ? pht('Permanent') : $autoclose_status,
|
||||
$permanent_status,
|
||||
);
|
||||
}
|
||||
$branch_table = new AphrontTableView($rows);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositoryActionsManagementPanel
|
||||
final class DiffusionRepositoryPublishingManagementPanel
|
||||
extends DiffusionRepositoryManagementPanel {
|
||||
|
||||
const PANELKEY = 'actions';
|
||||
const PANELKEY = 'publishing';
|
||||
|
||||
public function getManagementPanelLabel() {
|
||||
return pht('Actions');
|
||||
return pht('Publishing');
|
||||
}
|
||||
|
||||
public function getManagementPanelOrder() {
|
||||
|
@ -16,12 +16,7 @@ final class DiffusionRepositoryActionsManagementPanel
|
|||
public function getManagementPanelIcon() {
|
||||
$repository = $this->getRepository();
|
||||
|
||||
$has_any =
|
||||
$repository->getDetail('herald-disabled') ||
|
||||
$repository->getDetail('disable-autoclose');
|
||||
|
||||
// NOTE: Any value here really means something is disabled, so try to
|
||||
// hint that a little bit with the icon.
|
||||
$has_any = $repository->isPublishingDisabled();
|
||||
|
||||
if ($has_any) {
|
||||
return 'fa-flash';
|
||||
|
@ -33,7 +28,6 @@ final class DiffusionRepositoryActionsManagementPanel
|
|||
protected function getEditEngineFieldKeys() {
|
||||
return array(
|
||||
'publish',
|
||||
'autoclose',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -47,13 +41,13 @@ final class DiffusionRepositoryActionsManagementPanel
|
|||
$repository,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$actions_uri = $this->getEditPageURI();
|
||||
$publishing_uri = $this->getEditPageURI();
|
||||
|
||||
$action_list->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setIcon('fa-pencil')
|
||||
->setName(pht('Edit Actions'))
|
||||
->setHref($actions_uri)
|
||||
->setName(pht('Edit Publishing'))
|
||||
->setHref($publishing_uri)
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
|
@ -68,19 +62,13 @@ final class DiffusionRepositoryActionsManagementPanel
|
|||
$view = id(new PHUIPropertyListView())
|
||||
->setViewer($viewer);
|
||||
|
||||
$notify = $repository->getDetail('herald-disabled')
|
||||
$notify = $repository->isPublishingDisabled()
|
||||
? pht('Off')
|
||||
: pht('On');
|
||||
$notify = phutil_tag('em', array(), $notify);
|
||||
$view->addProperty(pht('Publish/Notify'), $notify);
|
||||
$view->addProperty(pht('Publishing'), $notify);
|
||||
|
||||
$autoclose = $repository->getDetail('disable-autoclose')
|
||||
? pht('Off')
|
||||
: pht('On');
|
||||
$autoclose = phutil_tag('em', array(), $autoclose);
|
||||
$view->addProperty(pht('Autoclose'), $autoclose);
|
||||
|
||||
return $this->newBox(pht('Actions'), $view);
|
||||
return $this->newBox(pht('Publishing'), $view);
|
||||
}
|
||||
|
||||
}
|
|
@ -60,7 +60,7 @@ final class DiffusionBranchTableView extends DiffusionView {
|
|||
break;
|
||||
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
|
||||
$icon = 'fa-times bluegrey';
|
||||
$tip = pht('Repository Autoclose Disabled');
|
||||
$tip = pht('Repository Publishing Disabled');
|
||||
break;
|
||||
case PhabricatorRepository::BECAUSE_BRANCH_UNTRACKED:
|
||||
$icon = 'fa-times bluegrey';
|
||||
|
@ -68,11 +68,11 @@ final class DiffusionBranchTableView extends DiffusionView {
|
|||
break;
|
||||
case PhabricatorRepository::BECAUSE_BRANCH_NOT_AUTOCLOSE:
|
||||
$icon = 'fa-times bluegrey';
|
||||
$tip = pht('Branch Autoclose Disabled');
|
||||
$tip = pht('Branch Not Permanent');
|
||||
break;
|
||||
case null:
|
||||
$icon = 'fa-check bluegrey';
|
||||
$tip = pht('Autoclose Enabled');
|
||||
$tip = pht('Permanent Branch');
|
||||
break;
|
||||
default:
|
||||
$icon = 'fa-question';
|
||||
|
|
|
@ -1048,13 +1048,17 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->getDetail('herald-disabled')) {
|
||||
if ($this->isPublishingDisabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isPublishingDisabled() {
|
||||
return $this->getDetail('herald-disabled');
|
||||
}
|
||||
|
||||
public function shouldPublishCommit(PhabricatorRepositoryCommit $commit) {
|
||||
if (!$this->shouldPublish()) {
|
||||
return false;
|
||||
|
@ -1186,7 +1190,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
return self::BECAUSE_REPOSITORY_IMPORTING;
|
||||
}
|
||||
|
||||
if ($this->getDetail('disable-autoclose', false)) {
|
||||
if ($this->isPublishingDisabled()) {
|
||||
return self::BECAUSE_AUTOCLOSE_DISABLED;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorRepositoryAutocloseTransaction
|
||||
extends PhabricatorRepositoryTransactionType {
|
||||
|
||||
const TRANSACTIONTYPE = 'repo:autoclose';
|
||||
|
||||
public function generateOldValue($object) {
|
||||
return (int)!$object->getDetail('disable-autoclose');
|
||||
}
|
||||
|
||||
public function generateNewValue($object, $value) {
|
||||
return (int)$value;
|
||||
}
|
||||
|
||||
public function applyInternalEffects($object, $value) {
|
||||
$object->setDetail('disable-autoclose', (int)!$value);
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
$new = $this->getNewValue();
|
||||
|
||||
if ($new) {
|
||||
return pht(
|
||||
'%s enabled autoclose for this repository.',
|
||||
$this->renderAuthor());
|
||||
} else {
|
||||
return pht(
|
||||
'%s disabled autoclose for this repository.',
|
||||
$this->renderAuthor());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,11 +22,11 @@ final class PhabricatorRepositoryNotifyTransaction
|
|||
|
||||
if ($new) {
|
||||
return pht(
|
||||
'%s enabled notifications and publishing for this repository.',
|
||||
'%s enabled publishing for this repository.',
|
||||
$this->renderAuthor());
|
||||
} else {
|
||||
return pht(
|
||||
'%s disabled notifications and publishing for this repository.',
|
||||
'%s disabled publishing for this repository.',
|
||||
$this->renderAuthor());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue