@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.

Prevent users from disabling repository builtin URIs

Summary:
Ref T10923. Currently, users can disable or enable builtin URIs, but this doesn't actually do anything.

The behavior of "disable" has changed a bit over time and might need some further refinement, but it's currently meaningless for builtin URIs. Prevent adjustment of it. If users want to hide a URI, they should set "Display: Hidden" instead.

Test Plan:
- Disabled/enabled a non-builtin URI.
- Tried to disable a builtin URI, saw greyed out UI and got a helpful error message.

Reviewers: chad

Reviewed By: chad

Subscribers: eadler

Maniphest Tasks: T10923

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

+33 -1
+10
src/applications/diffusion/controller/DiffusionRepositoryURIDisableController.php
··· 31 31 $is_disabled = $uri->getIsDisabled(); 32 32 $view_uri = $uri->getViewURI(); 33 33 34 + if ($uri->isBuiltin()) { 35 + return $this->newDialog() 36 + ->setTitle(pht('Builtin URI')) 37 + ->appendParagraph( 38 + pht( 39 + 'You can not manually disable builtin URIs. To hide a builtin '. 40 + 'URI, configure its "Display" behavior instead.')) 41 + ->addCancelButton($view_uri); 42 + } 43 + 34 44 if ($request->isFormPost()) { 35 45 $xactions = array(); 36 46
+3 -1
src/applications/diffusion/controller/DiffusionRepositoryURIViewController.php
··· 147 147 $disable_icon = 'fa-ban'; 148 148 } 149 149 150 + $can_disable = ($can_edit && !$uri->isBuiltin()); 151 + 150 152 $disable_uri = $repository->getPathURI("uri/disable/{$id}/"); 151 153 152 154 $curtain->addAction( ··· 155 157 ->setName($disable_name) 156 158 ->setHref($disable_uri) 157 159 ->setWorkflow(true) 158 - ->setDisabled(!$can_edit)); 160 + ->setDisabled(!$can_disable)); 159 161 160 162 return $curtain; 161 163 }
+20
src/applications/diffusion/editor/DiffusionURIEditor.php
··· 415 415 } 416 416 } 417 417 break; 418 + 419 + case PhabricatorRepositoryURITransaction::TYPE_DISABLE: 420 + $old = $object->getIsDisabled(); 421 + foreach ($xactions as $xaction) { 422 + $new = $xaction->getNewValue(); 423 + 424 + if ($old == $new) { 425 + continue; 426 + } 427 + 428 + if (!$object->isBuiltin()) { 429 + continue; 430 + } 431 + 432 + $errors[] = new PhabricatorApplicationTransactionValidationError( 433 + $type, 434 + pht('Invalid'), 435 + pht('You can not manually disable builtin URIs.')); 436 + } 437 + break; 418 438 } 419 439 420 440 return $errors;