Page MenuHomePhabricator

D15811.diff
No OneTemporary

D15811.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -743,6 +743,7 @@
'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',
@@ -4963,6 +4964,7 @@
'DiffusionRefTableController' => 'DiffusionController',
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionRenameHistoryQuery' => 'Phobject',
+ 'DiffusionRepositoryActionsManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryBranchesManagementPanel' => 'DiffusionRepositoryManagementPanel',
diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
--- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
+++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
@@ -143,6 +143,9 @@
->setLabel(pht('Allow Dangerous Changes'))
->setIsCopyable(true)
->setIsConduitOnly(true)
+ ->setOptions(
+ pht('Prevent Dangerous Changes'),
+ pht('Allow Dangerous Changes'))
->setTransactionType(PhabricatorRepositoryTransaction::TYPE_DANGEROUS)
->setDescription(pht('Permit dangerous changes to be made.'))
->setConduitDescription(pht('Allow or prevent dangerous changes.'))
@@ -235,6 +238,32 @@
->setConduitDescription(pht('Change symbol source repositories.'))
->setConduitTypeDescription(pht('New symbol repositories.'))
->setValue($object->getSymbolSources()),
+ id(new PhabricatorBoolEditField())
+ ->setKey('publish')
+ ->setLabel(pht('Publish/Notify'))
+ ->setTransactionType(
+ PhabricatorRepositoryTransaction::TYPE_NOTIFY)
+ ->setIsCopyable(true)
+ ->setOptions(
+ pht('Disable Notifications, Feed, and Herald'),
+ pht('Enable Notifications, Feed, and Herald'))
+ ->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(
+ PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE)
+ ->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')),
id(new PhabricatorPolicyEditField())
->setKey('policy.push')
->setLabel(pht('Push Policy'))
diff --git a/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php
@@ -0,0 +1,60 @@
+<?php
+
+final class DiffusionRepositoryActionsManagementPanel
+ extends DiffusionRepositoryManagementPanel {
+
+ const PANELKEY = 'actions';
+
+ public function getManagementPanelLabel() {
+ return pht('Actions');
+ }
+
+ public function getManagementPanelOrder() {
+ return 1100;
+ }
+
+ protected function buildManagementPanelActions() {
+ $repository = $this->getRepository();
+ $viewer = $this->getViewer();
+
+ $can_edit = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ $repository,
+ PhabricatorPolicyCapability::CAN_EDIT);
+
+ $actions_uri = $repository->getPathURI('edit/actions/');
+
+ return array(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-pencil')
+ ->setName(pht('Edit Actions'))
+ ->setHref($actions_uri)
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit),
+ );
+ }
+
+ public function buildManagementPanelContent() {
+ $repository = $this->getRepository();
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setViewer($viewer)
+ ->setActionList($this->newActions());
+
+ $notify = $repository->getDetail('herald-disabled')
+ ? pht('Off')
+ : pht('On');
+ $notify = phutil_tag('em', array(), $notify);
+ $view->addProperty(pht('Publish/Notify'), $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('Branches'), $view);
+ }
+
+}
diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
--- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php
+++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
@@ -342,7 +342,7 @@
$errors = parent::validateTransaction($object, $type, $xactions);
switch ($type) {
- case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE:
+ case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE_ONLY:
case PhabricatorRepositoryTransaction::TYPE_TRACK_ONLY:
foreach ($xactions as $xaction) {
foreach ($xaction->getNewValue() as $pattern) {
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -1808,8 +1808,9 @@
} catch (Exception $ex) {
throw new PhutilProxyException(
pht(
- 'Exception when processing transaction of type "%s".',
- $xaction['type']),
+ 'Exception when processing transaction of type "%s": %s',
+ $xaction['type'],
+ $ex->getMessage()),
$ex);
}
diff --git a/src/applications/transactions/editfield/PhabricatorBoolEditField.php b/src/applications/transactions/editfield/PhabricatorBoolEditField.php
--- a/src/applications/transactions/editfield/PhabricatorBoolEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorBoolEditField.php
@@ -3,13 +3,32 @@
final class PhabricatorBoolEditField
extends PhabricatorEditField {
+ private $options;
+
+ public function setOptions($off_label, $on_label) {
+ $this->options = array(
+ '0' => $off_label,
+ '1' => $on_label,
+ );
+ return $this;
+ }
+
+ public function getOptions() {
+ return $this->options;
+ }
+
protected function newControl() {
+ $options = $this->getOptions();
+
+ if (!$options) {
+ $options = array(
+ '0' => pht('False'),
+ '1' => pht('True'),
+ );
+ }
+
return id(new AphrontFormSelectControl())
- ->setOptions(
- array(
- '0' => pht('False'),
- '1' => pht('True'),
- ));
+ ->setOptions($options);
}
protected function newHTTPParameterType() {

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 12:41 PM (4 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711914
Default Alt Text
D15811.diff (8 KB)

Event Timeline