mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-21 22:32:41 +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,26 +49,15 @@ 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)
|
||||
->setFullWidth(true)
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setName('phids')
|
||||
->setLabel(pht('Recipients'))
|
||||
->setDatasource(new PhabricatorPeopleDatasource()));
|
||||
}
|
||||
$form = new AphrontFormView();
|
||||
$form
|
||||
->setUser($viewer)
|
||||
->setFullWidth(true)
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setName('phids')
|
||||
->setLabel(pht('Recipients'))
|
||||
->setDatasource(new PhabricatorPeopleDatasource()));
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($viewer)
|
||||
|
|
Loading…
Reference in a new issue