Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14007853
D15805.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D15805.diff
View Options
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
@@ -1934,6 +1934,7 @@
'PhabricatorBoardLayoutEngine' => 'applications/project/engine/PhabricatorBoardLayoutEngine.php',
'PhabricatorBoardRenderingEngine' => 'applications/project/engine/PhabricatorBoardRenderingEngine.php',
'PhabricatorBoardResponseEngine' => 'applications/project/engine/PhabricatorBoardResponseEngine.php',
+ 'PhabricatorBoolEditField' => 'applications/transactions/editfield/PhabricatorBoolEditField.php',
'PhabricatorBot' => 'infrastructure/daemon/bot/PhabricatorBot.php',
'PhabricatorBotChannel' => 'infrastructure/daemon/bot/target/PhabricatorBotChannel.php',
'PhabricatorBotDebugLogHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php',
@@ -4426,7 +4427,7 @@
'ConduitAPIRequest' => 'Phobject',
'ConduitAPIResponse' => 'Phobject',
'ConduitApplicationNotInstalledException' => 'ConduitMethodNotFoundException',
- 'ConduitBoolParameterType' => 'ConduitListParameterType',
+ 'ConduitBoolParameterType' => 'ConduitParameterType',
'ConduitCall' => 'Phobject',
'ConduitCallTestCase' => 'PhabricatorTestCase',
'ConduitColumnsParameterType' => 'ConduitParameterType',
@@ -6363,6 +6364,7 @@
'PhabricatorBoardLayoutEngine' => 'Phobject',
'PhabricatorBoardRenderingEngine' => 'Phobject',
'PhabricatorBoardResponseEngine' => 'Phobject',
+ 'PhabricatorBoolEditField' => 'PhabricatorEditField',
'PhabricatorBot' => 'PhabricatorDaemon',
'PhabricatorBotChannel' => 'PhabricatorBotTarget',
'PhabricatorBotDebugLogHandler' => 'PhabricatorBotHandler',
diff --git a/src/applications/conduit/parametertype/ConduitBoolParameterType.php b/src/applications/conduit/parametertype/ConduitBoolParameterType.php
--- a/src/applications/conduit/parametertype/ConduitBoolParameterType.php
+++ b/src/applications/conduit/parametertype/ConduitBoolParameterType.php
@@ -1,7 +1,7 @@
<?php
final class ConduitBoolParameterType
- extends ConduitListParameterType {
+ extends ConduitParameterType {
protected function getParameterValue(array $request, $key) {
$value = parent::getParameterValue($request, $key);
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
@@ -132,6 +132,16 @@
->setConduitDescription(pht('Change the default text encoding.'))
->setConduitTypeDescription(pht('New text encoding.'))
->setValue($object->getDetail('encoding')),
+ id(new PhabricatorBoolEditField())
+ ->setKey('allowDangerousChanges')
+ ->setLabel(pht('Allow Dangerous Changes'))
+ ->setIsCopyable(true)
+ ->setIsConduitOnly(true)
+ ->setTransactionType(PhabricatorRepositoryTransaction::TYPE_DANGEROUS)
+ ->setDescription(pht('Permit dangerous changes to be made.'))
+ ->setConduitDescription(pht('Allow or prevent dangerous changes.'))
+ ->setConduitTypeDescription(pht('New protection setting.'))
+ ->setValue($object->shouldAllowDangerousChanges()),
id(new PhabricatorSelectEditField())
->setKey('status')
->setLabel(pht('Status'))
diff --git a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
@@ -26,6 +26,7 @@
$activate_uri = $repository->getPathURI('edit/activate/');
$delete_uri = $repository->getPathURI('edit/delete/');
$encoding_uri = $repository->getPathURI('edit/encoding/');
+ $dangerous_uri = $repository->getPathURI('edit/dangerous/');
if ($repository->isTracked()) {
$activate_icon = 'fa-pause';
@@ -35,6 +36,17 @@
$activate_label = pht('Activate Repository');
}
+ $should_dangerous = $repository->shouldAllowDangerousChanges();
+ if ($should_dangerous) {
+ $dangerous_icon = 'fa-shield';
+ $dangerous_name = pht('Prevent Dangerous Changes');
+ $can_dangerous = $can_edit;
+ } else {
+ $dangerous_icon = 'fa-bullseye';
+ $dangerous_name = pht('Allow Dangerous Changes');
+ $can_dangerous = ($can_edit && $repository->canAllowDangerousChanges());
+ }
+
return array(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
@@ -49,6 +61,12 @@
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit),
id(new PhabricatorActionView())
+ ->setIcon($dangerous_icon)
+ ->setName($dangerous_name)
+ ->setHref($dangerous_uri)
+ ->setDisabled(!$can_dangerous)
+ ->setWorkflow(true),
+ id(new PhabricatorActionView())
->setHref($activate_uri)
->setIcon($activate_icon)
->setName($activate_label)
@@ -110,6 +128,20 @@
}
$view->addProperty(pht('Encoding'), $encoding);
+ $can_dangerous = $repository->canAllowDangerousChanges();
+ if (!$can_dangerous) {
+ $dangerous = phutil_tag('em', array(), pht('Not Preventable'));
+ } else {
+ $should_dangerous = $repository->shouldAllowDangerousChanges();
+ if ($should_dangerous) {
+ $dangerous = pht('Allowed');
+ } else {
+ $dangerous = pht('Not Allowed');
+ }
+ }
+
+ $view->addProperty(pht('Dangerous Changes'), $dangerous);
+
return $view;
}
diff --git a/src/applications/transactions/editfield/PhabricatorBoolEditField.php b/src/applications/transactions/editfield/PhabricatorBoolEditField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/transactions/editfield/PhabricatorBoolEditField.php
@@ -0,0 +1,23 @@
+<?php
+
+final class PhabricatorBoolEditField
+ extends PhabricatorEditField {
+
+ protected function newControl() {
+ return id(new AphrontFormSelectControl())
+ ->setOptions(
+ array(
+ '0' => pht('False'),
+ '1' => pht('True'),
+ ));
+ }
+
+ protected function newHTTPParameterType() {
+ return new AphrontBoolHTTPParameterType();
+ }
+
+ protected function newConduitParameterType() {
+ return new ConduitBoolParameterType();
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 30, 12:12 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720481
Default Alt Text
D15805.diff (6 KB)
Attached To
Mode
D15805: Port "Allow Dangerous Changes" to new Manage UI
Attached
Detach File
Event Timeline
Log In to Comment