mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +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:
parent
7909f6a919
commit
59678094fb
1 changed files with 9 additions and 20 deletions
|
@ -49,16 +49,6 @@ final class PhabricatorBadgesEditRecipientsController
|
||||||
->setURI($view_uri);
|
->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 = new AphrontFormView();
|
||||||
$form
|
$form
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
@ -68,7 +58,6 @@ final class PhabricatorBadgesEditRecipientsController
|
||||||
->setName('phids')
|
->setName('phids')
|
||||||
->setLabel(pht('Recipients'))
|
->setLabel(pht('Recipients'))
|
||||||
->setDatasource(new PhabricatorPeopleDatasource()));
|
->setDatasource(new PhabricatorPeopleDatasource()));
|
||||||
}
|
|
||||||
|
|
||||||
$dialog = id(new AphrontDialogView())
|
$dialog = id(new AphrontDialogView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
|
Loading…
Reference in a new issue