@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+8 -4
+8 -4
src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php
··· 85 85 $rename_uri = id(new PhutilURI($rename_uri)) 86 86 ->replaceQueryParam('contextPHID', $context_phid); 87 87 88 - $selected = 0; 88 + $key_list = array_keys($config); 89 89 90 - $key_list = array_keys($config); 90 + // In the future we may persist which panel was selected. 91 + // At the moment we have always selected the first one. 92 + $selected = (string)head($key_list); 91 93 92 94 $next_keys = array(); 93 95 $prev_keys = array(); ··· 111 113 $name = pht('Unnamed Tab'); 112 114 } 113 115 114 - $is_selected = (string)$idx === (string)$selected; 116 + // The $idx can be something like "0", "1" or "asdasd98". 117 + $is_selected = (string)$idx === $selected; 115 118 116 119 $tab_view = id(new PHUIListItemView()) 117 120 ->setHref('#') ··· 282 285 $panel_content = pht('(Invalid Panel)'); 283 286 } 284 287 285 - $is_selected = (string)$idx === (string)$selected; 288 + // Note that $idx can be something like "0", "1" or "asdasd98". 289 + $is_selected = (string)$idx === $selected; 286 290 287 291 $content_id = celerity_generate_unique_node_id(); 288 292