Fix diffusion.readmequery to work in a cluster enviroment

Summary:
Ref T2783. This method is kind of goofballs:

  - We send a big list of paths to it.
  - It sends back a giant blob of HTML.

Instead, just figure out the path we want locally, then fetch the content with `diffusion.filecontentquery`.

Test Plan:
  - Viewed main view and directory view, saw a README.
  - See screenshots.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2783

Differential Revision: https://secure.phabricator.com/D11099
This commit is contained in:
epriestley
2014-12-31 11:54:52 -08:00
parent 8c4f3edd8a
commit cae8c49745
6 changed files with 227 additions and 200 deletions

View File

@@ -151,15 +151,23 @@ final class DiffusionRepositoryController extends DiffusionController {
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$readme = null;
if ($browse_results) {
$readme = $this->callConduitWithDiffusionRequest(
'diffusion.readmequery',
array(
'paths' => $browse_results->getPathDicts(),
'commit' => $drequest->getStableCommit(),
));
} else {
$readme = null;
$readme_path = $browse_results->getReadmePath();
if ($readme_path) {
$readme_content = $this->callConduitWithDiffusionRequest(
'diffusion.filecontentquery',
array(
'path' => $readme_path,
'commit' => $drequest->getStableCommit(),
));
if ($readme_content) {
$readme = id(new DiffusionReadmeView())
->setUser($this->getViewer())
->setPath($readme_path)
->setContent($readme_content['corpus']);
}
}
}
$content[] = $this->buildBrowseTable(
@@ -195,14 +203,7 @@ final class DiffusionRepositoryController extends DiffusionController {
}
if ($readme) {
$box = new PHUIBoxView();
$box->appendChild($readme);
$box->addPadding(PHUI::PADDING_LARGE);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('README'));
$panel->appendChild($box);
$content[] = $panel;
$content[] = $readme;
}
return $content;