1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Remove history query from DiffusionRepositoryController as it is unused

Summary:
The history query for the repository page isn't actually used to display any content. It looks like it was previously used to display the last user which modified a file however this looks to be removed in D21404. This removes the history query from happening as well as updates `DiffusionBrowseTableView` to remove the parameters for passing this information in, resulting in also updating `DiffusionBrowseController` to no longer need to put this information together.

Refs T13666

Test Plan:
1. I removed commits from a repository on the local state.
2. I navigated to the repository's landing page and saw that the landing page attempted to render content and only failed to load the browse files section.
3. I navigated to the history tab and verified that it showed an exception about failing to query commit information.
4. I restored the repository working state to function properly.
5. I navigated to a repository's landing page and verified it loaded properly, including showing the last modified date for each file.
6. I navigated to the Code, Branches, Tags, and History tabs to verify each tab page loaded properly.
7. I verified on the Code tab that the last modified date for each file displayed properly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T13666

Differential Revision: https://secure.phabricator.com/D21717
This commit is contained in:
Christopher Speck 2021-09-04 01:49:57 -04:00
parent b757e5c302
commit 458ad4a861
3 changed files with 1 additions and 75 deletions

View file

@ -298,22 +298,8 @@ final class DiffusionBrowseController extends DiffusionController {
$empty_result->setDiffusionBrowseResultSet($results); $empty_result->setDiffusionBrowseResultSet($results);
$empty_result->setView($request->getStr('view')); $empty_result->setView($request->getStr('view'));
} else { } else {
$phids = array();
foreach ($results->getPaths() as $result) {
$data = $result->getLastCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
}
}
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$browse_table = id(new DiffusionBrowseTableView()) $browse_table = id(new DiffusionBrowseTableView())
->setDiffusionRequest($drequest) ->setDiffusionRequest($drequest)
->setHandles($handles)
->setPaths($results->getPaths()) ->setPaths($results->getPaths())
->setUser($request->getUser()); ->setUser($request->getUser());

View file

@ -2,7 +2,6 @@
final class DiffusionRepositoryController extends DiffusionController { final class DiffusionRepositoryController extends DiffusionController {
private $historyFuture;
private $browseFuture; private $browseFuture;
private $branchButton = null; private $branchButton = null;
private $branchFuture; private $branchFuture;
@ -191,15 +190,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$path = $drequest->getPath(); $path = $drequest->getPath();
$futures = array(); $futures = array();
$this->historyFuture = $this->callConduitMethod(
'diffusion.historyquery',
array(
'commit' => $commit,
'path' => $path,
'offset' => 0,
'limit' => 15,
));
$futures[] = $this->historyFuture;
$browse_pager = id(new PHUIPagerView()) $browse_pager = id(new PHUIPagerView())
->readFromRequest($request); ->readFromRequest($request);
@ -230,32 +220,8 @@ final class DiffusionRepositoryController extends DiffusionController {
// Just resolve all the futures before continuing. // Just resolve all the futures before continuing.
} }
$phids = array();
$content = array(); $content = array();
try {
$history_results = $this->historyFuture->resolve();
$history = DiffusionPathChange::newFromConduit(
$history_results['pathChanges']);
foreach ($history as $item) {
$data = $item->getCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
if ($data->getCommitDetail('committerPHID')) {
$phids[$data->getCommitDetail('committerPHID')] = true;
}
}
}
$history_exception = null;
} catch (Exception $ex) {
$history_results = null;
$history = null;
$history_exception = $ex;
}
try { try {
$browse_results = $this->browseFuture->resolve(); $browse_results = $this->browseFuture->resolve();
$browse_results = DiffusionBrowseResultSet::newFromConduit( $browse_results = DiffusionBrowseResultSet::newFromConduit(
@ -264,18 +230,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_paths = $browse_results->getPaths(); $browse_paths = $browse_results->getPaths();
$browse_paths = $browse_pager->sliceResults($browse_paths); $browse_paths = $browse_pager->sliceResults($browse_paths);
foreach ($browse_paths as $item) {
$data = $item->getLastCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
if ($data->getCommitDetail('committerPHID')) {
$phids[$data->getCommitDetail('committerPHID')] = true;
}
}
}
$browse_exception = null; $browse_exception = null;
} catch (Exception $ex) { } catch (Exception $ex) {
$browse_results = null; $browse_results = null;
@ -283,9 +237,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_exception = $ex; $browse_exception = $ex;
} }
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
if ($browse_results) { if ($browse_results) {
$readme = $this->renderDirectoryReadme($browse_results); $readme = $this->renderDirectoryReadme($browse_results);
} else { } else {
@ -296,7 +247,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_results, $browse_results,
$browse_paths, $browse_paths,
$browse_exception, $browse_exception,
$handles,
$browse_pager); $browse_pager);
if ($readme) { if ($readme) {
@ -524,7 +474,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_results, $browse_results,
$browse_paths, $browse_paths,
$browse_exception, $browse_exception,
array $handles,
PHUIPagerView $pager) { PHUIPagerView $pager) {
require_celerity_resource('diffusion-icons-css'); require_celerity_resource('diffusion-icons-css');
@ -547,8 +496,7 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_table = id(new DiffusionBrowseTableView()) $browse_table = id(new DiffusionBrowseTableView())
->setUser($viewer) ->setUser($viewer)
->setDiffusionRequest($drequest) ->setDiffusionRequest($drequest);
->setHandles($handles);
if ($browse_paths) { if ($browse_paths) {
$browse_table->setPaths($browse_paths); $browse_table->setPaths($browse_paths);
} else { } else {

View file

@ -3,7 +3,6 @@
final class DiffusionBrowseTableView extends DiffusionView { final class DiffusionBrowseTableView extends DiffusionView {
private $paths; private $paths;
private $handles = array();
public function setPaths(array $paths) { public function setPaths(array $paths) {
assert_instances_of($paths, 'DiffusionRepositoryPath'); assert_instances_of($paths, 'DiffusionRepositoryPath');
@ -11,12 +10,6 @@ final class DiffusionBrowseTableView extends DiffusionView {
return $this; return $this;
} }
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function render() { public function render() {
$request = $this->getDiffusionRequest(); $request = $this->getDiffusionRequest();
$repository = $request->getRepository(); $repository = $request->getRepository();
@ -29,7 +22,6 @@ final class DiffusionBrowseTableView extends DiffusionView {
$need_pull = array(); $need_pull = array();
$rows = array(); $rows = array();
$show_edit = false;
foreach ($this->paths as $path) { foreach ($this->paths as $path) {
$full_path = $base_path.$path->getPath(); $full_path = $base_path.$path->getPath();