mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-12 08:36:13 +01:00
Delete Repository button: disable if not admin, but show popup to all
Summary: The "Delete Repository" button should be disabled, just like any other admin button in the page, if you cannot edit the repository, so to do not cause anxiety situations to users without editing permissions. Moreover, probably, if you still want to click that disabled button, you should still be allowed to see the super-nice related information message, just because it's super-lovely, super-informative and it does nothing wrong. Closes T15964 Test Plan: Be normal user. See the button finally disabled. Click it, you finally see its related info popup instead "You shall not pass", so you unlock extra documentation to read. Be admin user. See the button still enabled. Click it, you still can see the info popup. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15964 Differential Revision: https://we.phorge.it/D25843
This commit is contained in:
parent
c589529155
commit
48fd3f1c40
2 changed files with 6 additions and 2 deletions
|
@ -4,7 +4,10 @@ final class DiffusionRepositoryEditDeleteController
|
||||||
extends DiffusionRepositoryManageController {
|
extends DiffusionRepositoryManageController {
|
||||||
|
|
||||||
public function handleRequest(AphrontRequest $request) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$response = $this->loadDiffusionContextForEdit();
|
// This is just an information box, telling admins to use CLI for destroy.
|
||||||
|
// To increase shared knowledge about how Phorge works, we can safely show
|
||||||
|
// it to those who see the repository, not just those who can edit it.
|
||||||
|
$response = $this->loadDiffusionContext();
|
||||||
if ($response) {
|
if ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,8 @@ final class DiffusionRepositoryBasicsManagementPanel
|
||||||
->setName(pht('Delete Repository'))
|
->setName(pht('Delete Repository'))
|
||||||
->setHref($delete_uri)
|
->setHref($delete_uri)
|
||||||
->setIcon('fa-times')
|
->setIcon('fa-times')
|
||||||
->setWorkflow(true));
|
->setWorkflow(true)
|
||||||
|
->setDisabled(!$can_edit));
|
||||||
|
|
||||||
return $this->newCurtainView()
|
return $this->newCurtainView()
|
||||||
->setActionList($action_list);
|
->setActionList($action_list);
|
||||||
|
|
Loading…
Reference in a new issue