From a4a22dd2f88916bcaaa51057369b200ffe9d9f02 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 6 May 2018 06:30:28 -0700 Subject: [PATCH] Mention the "inline comments" rule in the callout for "Large" diffs Summary: See PHI638. When a diff is large (between 100 and 1000 files), we collapse content by default unless a change also has inline comments. This rule isn't explicitly explained anywhere. Although it's not really a critical rule, it fits easily enough into the UI callout. Also render the UI callout in a slightly more modern way and avoid `hsprintf()`. Test Plan: {F5596496} - Also, clicked the "Expand" link and saw everything expand properly. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D19430 --- .../DifferentialRevisionViewController.php | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 9959bfabab..6b13e893d5 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -182,25 +182,31 @@ final class DifferentialRevisionViewController if ($large_warning) { $count = $this->getChangesetCount(); - $warning = new PHUIInfoView(); - $warning->setTitle(pht('Large Diff')); - $warning->setSeverity(PHUIInfoView::SEVERITY_WARNING); - $warning->appendChild(hsprintf( - '%s %s', + $expand_uri = $request_uri + ->alter('large', 'true') + ->setFragment('toc'); + + $message = array( pht( - 'This diff is large and affects %s files. '. - 'You may load each file individually or ', + 'This large diff affects %s files. Files without inline '. + 'comments have been collapsed.', new PhutilNumber($count)), + ' ', phutil_tag( - 'a', - array( - 'class' => 'button button-grey', - 'href' => $request_uri - ->alter('large', 'true') - ->setFragment('toc'), - ), - pht('Show All Files Inline')))); - $warning = $warning->render(); + 'strong', + array(), + phutil_tag( + 'a', + array( + 'href' => $expand_uri, + ), + pht('Expand All Files'))), + ); + + $warning = id(new PHUIInfoView()) + ->setTitle(pht('Large Diff')) + ->setSeverity(PHUIInfoView::SEVERITY_WARNING) + ->appendChild($message); $old = array_select_keys($changesets, $old_ids); $new = array_select_keys($changesets, $new_ids); -- 2.51.2