mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
4f615ad2a9
Summary: Resolves T2149. Test Plan: $ bin/storage upgrade # /owners/ - saw + # /owners/package/1/ - saw + # /owners/edit/1/ - added exclude paths, saw correct e-mail # /rPabc123 - included paths are still highlighted and excluded not # /owners/view/search/?path=/included/ - found # /owners/view/search/?path=/excluded/ - not found # owners.query - path: /included/ # owners.query - path: /excluded/ # new unit test PhabricatorOwnersPackage::loadAffectedPackages( $repository, array('/excluded/b.php')); PhabricatorOwnersPackage::loadAffectedPackages( $repository, array('/included/a.php')); Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2149 Differential Revision: https://secure.phabricator.com/D4102
103 lines
2.6 KiB
PHP
103 lines
2.6 KiB
PHP
<?php
|
|
|
|
final class DiffusionCommitChangeTableView extends DiffusionView {
|
|
|
|
private $pathChanges;
|
|
private $ownersPaths = array();
|
|
private $renderingReferences;
|
|
|
|
public function setPathChanges(array $path_changes) {
|
|
assert_instances_of($path_changes, 'DiffusionPathChange');
|
|
$this->pathChanges = $path_changes;
|
|
return $this;
|
|
}
|
|
|
|
public function setOwnersPaths(array $owners_paths) {
|
|
assert_instances_of($owners_paths, 'PhabricatorOwnersPath');
|
|
$this->ownersPaths = $owners_paths;
|
|
return $this;
|
|
}
|
|
|
|
public function setRenderingReferences(array $value) {
|
|
$this->renderingReferences = $value;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
$rows = array();
|
|
$rowc = array();
|
|
|
|
// TODO: Experiment with path stack rendering.
|
|
|
|
// TODO: Copy Away and Move Away are rendered junkily still.
|
|
|
|
foreach ($this->pathChanges as $id => $change) {
|
|
$path = $change->getPath();
|
|
$hash = substr(md5($path), 0, 8);
|
|
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
|
|
$path .= '/';
|
|
}
|
|
|
|
if (isset($this->renderingReferences[$id])) {
|
|
$path_column = javelin_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => '#'.$hash,
|
|
'meta' => array(
|
|
'id' => 'diff-'.$hash,
|
|
'ref' => $this->renderingReferences[$id],
|
|
),
|
|
'sigil' => 'differential-load',
|
|
),
|
|
phutil_escape_html($path));
|
|
} else {
|
|
$path_column = phutil_escape_html($path);
|
|
}
|
|
|
|
$rows[] = array(
|
|
$this->linkHistory($change->getPath()),
|
|
$this->linkBrowse($change->getPath()),
|
|
$this->linkChange(
|
|
$change->getChangeType(),
|
|
$change->getFileType(),
|
|
$change->getPath()),
|
|
$path_column,
|
|
);
|
|
|
|
$row_class = null;
|
|
foreach ($this->ownersPaths as $owners_path) {
|
|
$excluded = $owners_path->getExcluded();
|
|
$owners_path = $owners_path->getPath();
|
|
if (strncmp('/'.$path, $owners_path, strlen($owners_path)) == 0) {
|
|
if ($excluded) {
|
|
$row_class = null;
|
|
break;
|
|
}
|
|
$row_class = 'highlighted';
|
|
}
|
|
}
|
|
$rowc[] = $row_class;
|
|
}
|
|
|
|
$view = new AphrontTableView($rows);
|
|
$view->setHeaders(
|
|
array(
|
|
'History',
|
|
'Browse',
|
|
'Change',
|
|
'Path',
|
|
));
|
|
$view->setColumnClasses(
|
|
array(
|
|
'',
|
|
'',
|
|
'',
|
|
'wide',
|
|
));
|
|
$view->setRowClasses($rowc);
|
|
$view->setNoDataString('This change has not been fully parsed yet.');
|
|
|
|
return $view->render();
|
|
}
|
|
|
|
}
|