Colorize lines in blame under DocumentEngine, to show relative age of changes

Summary:
Depends on D19313. Ref T13105. Fixes T13015. We lost the coloration for ages in the switch to Document Engine.

Restore it, and use a wider range of colors to make the information more clear.

Test Plan: Viewed some blame, saw a nice explosion of bright colors. This is a cornerstone of good design.

Maniphest Tasks: T13105, T13015

Differential Revision: https://secure.phabricator.com/D19314
This commit is contained in:
epriestley
2018-04-09 06:05:40 -07:00
parent cf75d63b49
commit 472bc3d90a
4 changed files with 84 additions and 13 deletions

View File

@@ -80,7 +80,9 @@ final class DiffusionBlameController extends DiffusionController {
$handles = $viewer->loadHandles($handle_phids);
$map = array();
$epochs = array();
foreach ($identifiers as $identifier) {
$revision_id = idx($revision_map, $identifier);
if ($revision_id) {
@@ -173,23 +175,34 @@ final class DiffusionBlameController extends DiffusionController {
$info = array(
$info,
' / ',
" \xC2\xB7 ",
$revision_link,
);
}
$epoch = $commit->getEpoch();
$epochs[] = $epoch;
$data = array(
'skip' => $skip_link,
'info' => hsprintf('%s', $info),
'epoch' => $epoch,
);
$map[$identifier] = $data;
}
$epoch_min = min($epochs);
$epoch_max = max($epochs);
return id(new AphrontAjaxResponse())->setContent(
array(
'blame' => $blame,
'map' => $map,
'epoch' => array(
'min' => $epoch_min,
'max' => $epoch_max,
),
));
}