mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Dashboard Panel: fix first tab sometime not opened anymore
Summary: After this change the first Tab ID is always selected, so we don't risk to have no tabs opened by default under some corner cases. This is vaguely better than the original logic that relied on the fact that (0=="0") is true. Besides being a vaguely weird emoticon as well, now that I look at it better. Original logic: https://we.phorge.it/source/phorge/browse/master/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php;c43618a3a8bb021936fad687f04cb1a95faa23e4$289 This fixes a regression that appeared in the cute Wikimedia Phabricator (that now is really Wikimedia Phorge). Their homepage should be gorgeous again, without blank space due to unopened silly tabs. Closes T15651 Test Plan: - Have a Tab Panel (/dashboard/panel/). - Be sure that the first Tab is automatically selected (again?) Reviewers: aklapper, O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15651 Differential Revision: https://we.phorge.it/D25447
This commit is contained in:
parent
94aefaa31d
commit
2d635fb76e
1 changed files with 8 additions and 4 deletions
|
@ -85,10 +85,12 @@ final class PhabricatorDashboardTabsPanelType
|
||||||
$rename_uri = id(new PhutilURI($rename_uri))
|
$rename_uri = id(new PhutilURI($rename_uri))
|
||||||
->replaceQueryParam('contextPHID', $context_phid);
|
->replaceQueryParam('contextPHID', $context_phid);
|
||||||
|
|
||||||
$selected = 0;
|
|
||||||
|
|
||||||
$key_list = array_keys($config);
|
$key_list = array_keys($config);
|
||||||
|
|
||||||
|
// In the future we may persist which panel was selected.
|
||||||
|
// At the moment we have always selected the first one.
|
||||||
|
$selected = (string)head($key_list);
|
||||||
|
|
||||||
$next_keys = array();
|
$next_keys = array();
|
||||||
$prev_keys = array();
|
$prev_keys = array();
|
||||||
for ($ii = 0; $ii < count($key_list); $ii++) {
|
for ($ii = 0; $ii < count($key_list); $ii++) {
|
||||||
|
@ -111,7 +113,8 @@ final class PhabricatorDashboardTabsPanelType
|
||||||
$name = pht('Unnamed Tab');
|
$name = pht('Unnamed Tab');
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_selected = (string)$idx === (string)$selected;
|
// The $idx can be something like "0", "1" or "asdasd98".
|
||||||
|
$is_selected = (string)$idx === $selected;
|
||||||
|
|
||||||
$tab_view = id(new PHUIListItemView())
|
$tab_view = id(new PHUIListItemView())
|
||||||
->setHref('#')
|
->setHref('#')
|
||||||
|
@ -282,7 +285,8 @@ final class PhabricatorDashboardTabsPanelType
|
||||||
$panel_content = pht('(Invalid Panel)');
|
$panel_content = pht('(Invalid Panel)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_selected = (string)$idx === (string)$selected;
|
// Note that $idx can be something like "0", "1" or "asdasd98".
|
||||||
|
$is_selected = (string)$idx === $selected;
|
||||||
|
|
||||||
$content_id = celerity_generate_unique_node_id();
|
$content_id = celerity_generate_unique_node_id();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue