Summary: Ref T603. I got most of this earlier, but finish it up. - Make a couple of controllers public; pretty much everything in Diffusion has implicit policy checks as a result of building a `DiffusionRequest`. - Add an "Edit" capability to commits. - Swap out the comment thing for commits. - Disable actions if the user can't take them. Test Plan: Viewed a bunch of interfaces while logged out, got appropriate results or roadblocks. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D7152
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class DiffusionLastModifiedController extends DiffusionController {
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function processRequest() {
|
|
$drequest = $this->getDiffusionRequest();
|
|
$request = $this->getRequest();
|
|
$commit = null;
|
|
$commit_data = null;
|
|
|
|
$conduit_result = $this->callConduitWithDiffusionRequest(
|
|
'diffusion.lastmodifiedquery',
|
|
array(
|
|
'commit' => $drequest->getCommit(),
|
|
'path' => $drequest->getPath()
|
|
));
|
|
$c_dict = $conduit_result['commit'];
|
|
if ($c_dict) {
|
|
$commit = PhabricatorRepositoryCommit::newFromDictionary($c_dict);
|
|
}
|
|
$c_d_dict = $conduit_result['commitData'];
|
|
if ($c_d_dict) {
|
|
$commit_data =
|
|
PhabricatorRepositoryCommitData::newFromDictionary($c_d_dict);
|
|
}
|
|
|
|
$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;
|
|
}
|
|
}
|
|
|
|
$phids = array_keys($phids);
|
|
$handles = $this->loadViewerHandles($phids);
|
|
|
|
$view = new DiffusionBrowseTableView();
|
|
$view->setUser($request->getUser());
|
|
$output = $view->renderLastModifiedColumns(
|
|
$drequest,
|
|
$handles,
|
|
$commit,
|
|
$commit_data);
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
->setContent($output);
|
|
}
|
|
}
|