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

Fix a fatal on user email settings when account.editable is disabled

Summary:
If `account.editable` is set to false, we try to add a `null` button and fatal:

> Argument 1 passed to PHUIHeaderView::addActionLink() must be an instance of PHUIButtonView, null given, called in /srv/phabricator/phabricator/src/applications/settings/panel/PhabricatorSettingsPanel.php on line 290

Instead, don't try to render `null` as a button.

Test Plan:
  - Configured `account.editable` false.
  - Viewed email address settings.
  - Before: fatal.
  - After: page works, no button is provided.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18677
This commit is contained in:
epriestley 2017-10-04 07:16:33 -07:00
parent bc9de7ecee
commit b9fd526250

View file

@ -138,9 +138,9 @@ final class PhabricatorEmailAddressesSettingsPanel
$editable, $editable,
)); ));
$button = null; $buttons = array();
if ($editable) { if ($editable) {
$button = id(new PHUIButtonView()) $buttons[] = id(new PHUIButtonView())
->setTag('a') ->setTag('a')
->setIcon('fa-plus') ->setIcon('fa-plus')
->setText(pht('Add New Address')) ->setText(pht('Add New Address'))
@ -149,7 +149,7 @@ final class PhabricatorEmailAddressesSettingsPanel
->setColor(PHUIButtonView::GREY); ->setColor(PHUIButtonView::GREY);
} }
return $this->newBox(pht('Email Addresses'), $table, array($button)); return $this->newBox(pht('Email Addresses'), $table, $buttons);
} }
private function returnNewAddressResponse( private function returnNewAddressResponse(