@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.

In Differential: when the file tree is enabled, default to the "History" tab instead of "Files"

Summary:
Ref T13187. See PHI811. If the file tree is enabled and visible, set the default tab to "History".

- This is a bit magic.
- It won't work entirely on mobile (we can't tell that you're on mobile on the server, so we'll pick the "History" tab even though the file tree isn't actually visible on your device).
- There's no corresponding logic in Diffusion. Diffusion doesn't have the same tab layout, but this makes things somewhat inconsistent.

So I don't love this, but we can try it and see if it's confusing or helpful on the balance.

Test Plan: With filetree on and off, reloaded revisions. Saw appropriate tab selected by default.

Reviewers: amckinley

Maniphest Tasks: T13187

Differential Revision: https://secure.phabricator.com/D19601

+26 -20
+26 -20
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 463 463 } 464 464 } 465 465 466 - $tab_group = id(new PHUITabGroupView()); 466 + $tab_group = new PHUITabGroupView(); 467 467 468 468 if ($toc_view) { 469 469 $tab_group->addTab( ··· 473 473 ->appendChild($toc_view)); 474 474 } 475 475 476 - $tab_group 477 - ->addTab( 478 - id(new PHUITabView()) 479 - ->setName(pht('History')) 480 - ->setKey('history') 481 - ->appendChild($history)) 482 - ->addTab( 483 - id(new PHUITabView()) 484 - ->setName(pht('Commits')) 485 - ->setKey('commits') 486 - ->appendChild($local_table)); 476 + $tab_group->addTab( 477 + id(new PHUITabView()) 478 + ->setName(pht('History')) 479 + ->setKey('history') 480 + ->appendChild($history)); 481 + 482 + $filetree_on = $viewer->compareUserSetting( 483 + PhabricatorShowFiletreeSetting::SETTINGKEY, 484 + PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE); 485 + 486 + $collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY; 487 + $filetree_collapsed = (bool)$viewer->getUserSetting($collapsed_key); 488 + 489 + // See PHI811. If the viewer has the file tree on, the files tab with the 490 + // table of contents is redundant, so default to the "History" tab instead. 491 + if ($filetree_on && !$filetree_collapsed) { 492 + $tab_group->selectTab('history'); 493 + } 494 + 495 + $tab_group->addTab( 496 + id(new PHUITabView()) 497 + ->setName(pht('Commits')) 498 + ->setKey('commits') 499 + ->appendChild($local_table)); 487 500 488 501 $stack_graph = id(new DifferentialRevisionGraph()) 489 502 ->setViewer($viewer) ··· 601 614 $crumbs->addTextCrumb($monogram); 602 615 $crumbs->setBorder(true); 603 616 604 - $filetree_on = $viewer->compareUserSetting( 605 - PhabricatorShowFiletreeSetting::SETTINGKEY, 606 - PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE); 607 - 608 617 $nav = null; 609 618 if ($filetree_on && !$this->isVeryLargeDiff()) { 610 - $collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY; 611 - $collapsed_value = $viewer->getUserSetting($collapsed_key); 612 - 613 619 $width_key = PhabricatorFiletreeWidthSetting::SETTINGKEY; 614 620 $width_value = $viewer->getUserSetting($width_key); 615 621 616 622 $nav = id(new DifferentialChangesetFileTreeSideNavBuilder()) 617 623 ->setTitle($monogram) 618 624 ->setBaseURI(new PhutilURI($revision->getURI())) 619 - ->setCollapsed((bool)$collapsed_value) 625 + ->setCollapsed($filetree_collapsed) 620 626 ->setWidth((int)$width_value) 621 627 ->build($changesets); 622 628 }