Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15427204
D15899.id38292.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D15899.id38292.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D15899: Prevent users from disabling repository builtin URIs
Attached
Detach File
Event Timeline
Log In to Comment