2011-03-31 08:27:06 +02:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DiffusionLastModifiedController extends DiffusionController {
|
2011-03-31 08:27:06 +02:00
|
|
|
|
2013-09-27 19:49:45 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-03-31 08:27:06 +02:00
|
|
|
public function processRequest() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
2014-05-11 00:32:53 +02:00
|
|
|
$paths = $request->getStr('paths');
|
|
|
|
$paths = json_decode($paths, true);
|
|
|
|
|
|
|
|
$output = array();
|
|
|
|
foreach ($paths as $path) {
|
|
|
|
$prequest = clone $drequest;
|
|
|
|
$prequest->setPath($path);
|
|
|
|
|
|
|
|
$conduit_result = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.lastmodifiedquery',
|
|
|
|
array(
|
|
|
|
'commit' => $prequest->getCommit(),
|
|
|
|
'path' => $prequest->getPath(),
|
|
|
|
));
|
|
|
|
|
|
|
|
$commit = PhabricatorRepositoryCommit::newFromDictionary(
|
|
|
|
$conduit_result['commit']);
|
|
|
|
|
|
|
|
$commit_data = PhabricatorRepositoryCommitData::newFromDictionary(
|
|
|
|
$conduit_result['commitData']);
|
|
|
|
|
|
|
|
$phids = array();
|
|
|
|
if ($commit_data) {
|
|
|
|
if ($commit_data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[$commit_data->getCommitDetail('authorPHID')] = true;
|
|
|
|
}
|
|
|
|
if ($commit_data->getCommitDetail('committerPHID')) {
|
|
|
|
$phids[$commit_data->getCommitDetail('committerPHID')] = true;
|
|
|
|
}
|
2012-05-23 17:34:36 +02:00
|
|
|
}
|
2011-04-03 01:39:23 +02:00
|
|
|
|
2014-05-11 00:32:53 +02:00
|
|
|
$phids = array_keys($phids);
|
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-03 01:39:23 +02:00
|
|
|
|
2014-05-11 00:32:53 +02:00
|
|
|
$view = new DiffusionBrowseTableView();
|
|
|
|
$view->setUser($request->getUser());
|
|
|
|
$output[$path] = $view->renderLastModifiedColumns(
|
|
|
|
$prequest,
|
|
|
|
$handles,
|
|
|
|
$commit,
|
|
|
|
$commit_data);
|
|
|
|
}
|
2011-03-31 08:27:06 +02:00
|
|
|
|
2014-05-11 00:32:53 +02:00
|
|
|
return id(new AphrontAjaxResponse())->setContent($output);
|
2011-03-31 08:27:06 +02:00
|
|
|
}
|
|
|
|
}
|