2011-03-30 23:27:06 -07:00
|
|
|
<?php
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class DiffusionLastModifiedController extends DiffusionController {
|
2011-03-30 23:27:06 -07:00
|
|
|
|
2013-09-27 10:49:45 -07:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-03-30 23:27:06 -07:00
|
|
|
public function processRequest() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
2014-05-10 15:32:53 -07: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 08:34:36 -07:00
|
|
|
}
|
2011-04-02 16:39:23 -07:00
|
|
|
|
2014-05-10 15:32:53 -07:00
|
|
|
$phids = array_keys($phids);
|
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-02 16:39:23 -07:00
|
|
|
|
2014-05-10 15:32:53 -07:00
|
|
|
$view = new DiffusionBrowseTableView();
|
|
|
|
$view->setUser($request->getUser());
|
|
|
|
$output[$path] = $view->renderLastModifiedColumns(
|
|
|
|
$prequest,
|
|
|
|
$handles,
|
|
|
|
$commit,
|
|
|
|
$commit_data);
|
|
|
|
}
|
2011-03-30 23:27:06 -07:00
|
|
|
|
2014-05-10 15:32:53 -07:00
|
|
|
return id(new AphrontAjaxResponse())->setContent($output);
|
2011-03-30 23:27:06 -07:00
|
|
|
}
|
|
|
|
}
|