1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

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
This commit is contained in:
epriestley 2018-05-06 06:30:28 -07:00
parent 4a98e0ff65
commit a4a22dd2f8

View file

@ -182,25 +182,31 @@ final class DifferentialRevisionViewController
if ($large_warning) { if ($large_warning) {
$count = $this->getChangesetCount(); $count = $this->getChangesetCount();
$warning = new PHUIInfoView(); $expand_uri = $request_uri
$warning->setTitle(pht('Large Diff')); ->alter('large', 'true')
$warning->setSeverity(PHUIInfoView::SEVERITY_WARNING); ->setFragment('toc');
$warning->appendChild(hsprintf(
'%s <strong>%s</strong>', $message = array(
pht( pht(
'This diff is large and affects %s files. '. 'This large diff affects %s files. Files without inline '.
'You may load each file individually or ', 'comments have been collapsed.',
new PhutilNumber($count)), new PhutilNumber($count)),
' ',
phutil_tag(
'strong',
array(),
phutil_tag( phutil_tag(
'a', 'a',
array( array(
'class' => 'button button-grey', 'href' => $expand_uri,
'href' => $request_uri
->alter('large', 'true')
->setFragment('toc'),
), ),
pht('Show All Files Inline')))); pht('Expand All Files'))),
$warning = $warning->render(); );
$warning = id(new PHUIInfoView())
->setTitle(pht('Large Diff'))
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->appendChild($message);
$old = array_select_keys($changesets, $old_ids); $old = array_select_keys($changesets, $old_ids);
$new = array_select_keys($changesets, $new_ids); $new = array_select_keys($changesets, $new_ids);