@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Port "Allow Dangerous Changes" to new Manage UI

Summary: Ref T10748. Brings this forward in the UI and EditEngine.

Test Plan:
- Edited via Conduit.
- Viewed via Manage UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

Differential Revision: https://secure.phabricator.com/D15805

+69 -2
+3 -1
src/__phutil_library_map__.php
··· 1934 1934 'PhabricatorBoardLayoutEngine' => 'applications/project/engine/PhabricatorBoardLayoutEngine.php', 1935 1935 'PhabricatorBoardRenderingEngine' => 'applications/project/engine/PhabricatorBoardRenderingEngine.php', 1936 1936 'PhabricatorBoardResponseEngine' => 'applications/project/engine/PhabricatorBoardResponseEngine.php', 1937 + 'PhabricatorBoolEditField' => 'applications/transactions/editfield/PhabricatorBoolEditField.php', 1937 1938 'PhabricatorBot' => 'infrastructure/daemon/bot/PhabricatorBot.php', 1938 1939 'PhabricatorBotChannel' => 'infrastructure/daemon/bot/target/PhabricatorBotChannel.php', 1939 1940 'PhabricatorBotDebugLogHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php', ··· 4426 4427 'ConduitAPIRequest' => 'Phobject', 4427 4428 'ConduitAPIResponse' => 'Phobject', 4428 4429 'ConduitApplicationNotInstalledException' => 'ConduitMethodNotFoundException', 4429 - 'ConduitBoolParameterType' => 'ConduitListParameterType', 4430 + 'ConduitBoolParameterType' => 'ConduitParameterType', 4430 4431 'ConduitCall' => 'Phobject', 4431 4432 'ConduitCallTestCase' => 'PhabricatorTestCase', 4432 4433 'ConduitColumnsParameterType' => 'ConduitParameterType', ··· 6363 6364 'PhabricatorBoardLayoutEngine' => 'Phobject', 6364 6365 'PhabricatorBoardRenderingEngine' => 'Phobject', 6365 6366 'PhabricatorBoardResponseEngine' => 'Phobject', 6367 + 'PhabricatorBoolEditField' => 'PhabricatorEditField', 6366 6368 'PhabricatorBot' => 'PhabricatorDaemon', 6367 6369 'PhabricatorBotChannel' => 'PhabricatorBotTarget', 6368 6370 'PhabricatorBotDebugLogHandler' => 'PhabricatorBotHandler',
+1 -1
src/applications/conduit/parametertype/ConduitBoolParameterType.php
··· 1 1 <?php 2 2 3 3 final class ConduitBoolParameterType 4 - extends ConduitListParameterType { 4 + extends ConduitParameterType { 5 5 6 6 protected function getParameterValue(array $request, $key) { 7 7 $value = parent::getParameterValue($request, $key);
+10
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
··· 132 132 ->setConduitDescription(pht('Change the default text encoding.')) 133 133 ->setConduitTypeDescription(pht('New text encoding.')) 134 134 ->setValue($object->getDetail('encoding')), 135 + id(new PhabricatorBoolEditField()) 136 + ->setKey('allowDangerousChanges') 137 + ->setLabel(pht('Allow Dangerous Changes')) 138 + ->setIsCopyable(true) 139 + ->setIsConduitOnly(true) 140 + ->setTransactionType(PhabricatorRepositoryTransaction::TYPE_DANGEROUS) 141 + ->setDescription(pht('Permit dangerous changes to be made.')) 142 + ->setConduitDescription(pht('Allow or prevent dangerous changes.')) 143 + ->setConduitTypeDescription(pht('New protection setting.')) 144 + ->setValue($object->shouldAllowDangerousChanges()), 135 145 id(new PhabricatorSelectEditField()) 136 146 ->setKey('status') 137 147 ->setLabel(pht('Status'))
+32
src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
··· 26 26 $activate_uri = $repository->getPathURI('edit/activate/'); 27 27 $delete_uri = $repository->getPathURI('edit/delete/'); 28 28 $encoding_uri = $repository->getPathURI('edit/encoding/'); 29 + $dangerous_uri = $repository->getPathURI('edit/dangerous/'); 29 30 30 31 if ($repository->isTracked()) { 31 32 $activate_icon = 'fa-pause'; ··· 35 36 $activate_label = pht('Activate Repository'); 36 37 } 37 38 39 + $should_dangerous = $repository->shouldAllowDangerousChanges(); 40 + if ($should_dangerous) { 41 + $dangerous_icon = 'fa-shield'; 42 + $dangerous_name = pht('Prevent Dangerous Changes'); 43 + $can_dangerous = $can_edit; 44 + } else { 45 + $dangerous_icon = 'fa-bullseye'; 46 + $dangerous_name = pht('Allow Dangerous Changes'); 47 + $can_dangerous = ($can_edit && $repository->canAllowDangerousChanges()); 48 + } 49 + 38 50 return array( 39 51 id(new PhabricatorActionView()) 40 52 ->setIcon('fa-pencil') ··· 48 60 ->setHref($encoding_uri) 49 61 ->setDisabled(!$can_edit) 50 62 ->setWorkflow(!$can_edit), 63 + id(new PhabricatorActionView()) 64 + ->setIcon($dangerous_icon) 65 + ->setName($dangerous_name) 66 + ->setHref($dangerous_uri) 67 + ->setDisabled(!$can_dangerous) 68 + ->setWorkflow(true), 51 69 id(new PhabricatorActionView()) 52 70 ->setHref($activate_uri) 53 71 ->setIcon($activate_icon) ··· 109 127 $encoding = phutil_tag('em', array(), pht('Use Default (UTF-8)')); 110 128 } 111 129 $view->addProperty(pht('Encoding'), $encoding); 130 + 131 + $can_dangerous = $repository->canAllowDangerousChanges(); 132 + if (!$can_dangerous) { 133 + $dangerous = phutil_tag('em', array(), pht('Not Preventable')); 134 + } else { 135 + $should_dangerous = $repository->shouldAllowDangerousChanges(); 136 + if ($should_dangerous) { 137 + $dangerous = pht('Allowed'); 138 + } else { 139 + $dangerous = pht('Not Allowed'); 140 + } 141 + } 142 + 143 + $view->addProperty(pht('Dangerous Changes'), $dangerous); 112 144 113 145 return $view; 114 146 }
+23
src/applications/transactions/editfield/PhabricatorBoolEditField.php
··· 1 + <?php 2 + 3 + final class PhabricatorBoolEditField 4 + extends PhabricatorEditField { 5 + 6 + protected function newControl() { 7 + return id(new AphrontFormSelectControl()) 8 + ->setOptions( 9 + array( 10 + '0' => pht('False'), 11 + '1' => pht('True'), 12 + )); 13 + } 14 + 15 + protected function newHTTPParameterType() { 16 + return new AphrontBoolHTTPParameterType(); 17 + } 18 + 19 + protected function newConduitParameterType() { 20 + return new ConduitBoolParameterType(); 21 + } 22 + 23 + }