Page MenuHomePhabricator

D15899.id38292.diff
No OneTemporary

D15899.id38292.diff

diff --git a/src/applications/diffusion/controller/DiffusionRepositoryURIDisableController.php b/src/applications/diffusion/controller/DiffusionRepositoryURIDisableController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryURIDisableController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryURIDisableController.php
@@ -31,6 +31,16 @@
$is_disabled = $uri->getIsDisabled();
$view_uri = $uri->getViewURI();
+ if ($uri->isBuiltin()) {
+ return $this->newDialog()
+ ->setTitle(pht('Builtin URI'))
+ ->appendParagraph(
+ pht(
+ 'You can not manually disable builtin URIs. To hide a builtin '.
+ 'URI, configure its "Display" behavior instead.'))
+ ->addCancelButton($view_uri);
+ }
+
if ($request->isFormPost()) {
$xactions = array();
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryURIViewController.php b/src/applications/diffusion/controller/DiffusionRepositoryURIViewController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryURIViewController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryURIViewController.php
@@ -147,6 +147,8 @@
$disable_icon = 'fa-ban';
}
+ $can_disable = ($can_edit && !$uri->isBuiltin());
+
$disable_uri = $repository->getPathURI("uri/disable/{$id}/");
$curtain->addAction(
@@ -155,7 +157,7 @@
->setName($disable_name)
->setHref($disable_uri)
->setWorkflow(true)
- ->setDisabled(!$can_edit));
+ ->setDisabled(!$can_disable));
return $curtain;
}
diff --git a/src/applications/diffusion/editor/DiffusionURIEditor.php b/src/applications/diffusion/editor/DiffusionURIEditor.php
--- a/src/applications/diffusion/editor/DiffusionURIEditor.php
+++ b/src/applications/diffusion/editor/DiffusionURIEditor.php
@@ -415,6 +415,26 @@
}
}
break;
+
+ case PhabricatorRepositoryURITransaction::TYPE_DISABLE:
+ $old = $object->getIsDisabled();
+ foreach ($xactions as $xaction) {
+ $new = $xaction->getNewValue();
+
+ if ($old == $new) {
+ continue;
+ }
+
+ if (!$object->isBuiltin()) {
+ continue;
+ }
+
+ $errors[] = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Invalid'),
+ pht('You can not manually disable builtin URIs.'));
+ }
+ break;
}
return $errors;

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 1:18 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7720279
Default Alt Text
D15899.id38292.diff (2 KB)

Event Timeline