1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

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) {

View file

@ -190,10 +190,10 @@ final class PHUIObjectBoxView extends AphrontView {
}
public function render() {
require_celerity_resource('phui-object-box-css');
$header = $this->header;
if ($this->headerText) {
$header = id(new PHUIHeaderView())
->setHeader($this->headerText);
@ -201,6 +201,10 @@ final class PHUIObjectBoxView extends AphrontView {
$showhide = null;
if ($this->showAction !== null) {
if (!$header) {
$header = id(new PHUIHeaderView());
}
Javelin::initBehavior('phabricator-reveal-content');
$hide_action_id = celerity_generate_unique_node_id();