Render ApplicationSearch errors correctly

Summary:
Fixes T8774. When an ApplicationSearch page returned an error (e.g., using a "viewer()" query while logged out), we would try to add action links to a box without a header. Instead:

  - If a box has no header, but has show/hide actions, just create an empty header so the view renders. This is a little silly looking but does what the caller asks.
  - Always set the title on the result box, so we get a header.

Test Plan: Did an invalid (logged out, with viewer()) search. Did a valid search.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8774

Differential Revision: https://secure.phabricator.com/D13576
This commit is contained in:
epriestley
2015-07-07 11:52:06 -07:00
parent 9618ab6426
commit 1a001ca033
2 changed files with 10 additions and 8 deletions

View File

@@ -185,7 +185,11 @@ final class PhabricatorApplicationSearchController
$title = pht('Advanced Search');
}
$box = new PHUIObjectBoxView();
$header = id(new PHUIHeaderView())
->setHeader($title);
$box = id(new PHUIObjectBoxView())
->setHeader($header);
if ($run_query || $named_query) {
$box->setShowHide(
@@ -227,16 +231,12 @@ final class PhabricatorApplicationSearchController
$saved_query);
}
$header = id(new PHUIHeaderView())
->setHeader($title);
if ($list->getActions()) {
foreach ($list->getActions() as $action) {
$header->addActionLink($action);
}
}
$box->setHeader($header);
if ($list->getObjectList()) {
$box->setObjectList($list->getObjectList());
}
@@ -267,8 +267,6 @@ final class PhabricatorApplicationSearchController
'This query specifies an invalid parameter. Review the '.
'query parameters and correct errors.');
}
} else {
$box->setHeaderText($title);
}
if ($errors) {