1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Refactor PhabricatorBadgesEditRecipientsController to remove dead code

Summary: `$form` in `$dialog = id(new AphrontDialogView())->appendForm($form)` is only defined when `if ($can_edit)` was `true` beforehand. But that was always true. Thus add a variable definition (and remove some unused variables like `$form_box`).

Test Plan:
Visit the page /badges/recipients/1/ or also directly /badges/recipients/1/add/ and add some recipients. It still works as before.

Visit the page without enough permissions. It does not allow to edit them, as before.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25744
This commit is contained in:
Andre Klapper 2024-07-25 15:42:14 +02:00
parent 7909f6a919
commit 59678094fb

View file

@ -49,16 +49,6 @@ final class PhabricatorBadgesEditRecipientsController
->setURI($view_uri);
}
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$badge,
PhabricatorPolicyCapability::CAN_EDIT);
$form_box = null;
$title = pht('Add Recipient');
if ($can_edit) {
$header_name = pht('Edit Recipients');
$form = new AphrontFormView();
$form
->setUser($viewer)
@ -68,7 +58,6 @@ final class PhabricatorBadgesEditRecipientsController
->setName('phids')
->setLabel(pht('Recipients'))
->setDatasource(new PhabricatorPeopleDatasource()));
}
$dialog = id(new AphrontDialogView())
->setUser($viewer)