Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/diffusion/controller/DiffusionLastModifiedController.php b/src/applications/diffusion/controller/DiffusionLastModifiedController.php
index 1a31d3a2ba..92f5b50a8a 100644
--- a/src/applications/diffusion/controller/DiffusionLastModifiedController.php
+++ b/src/applications/diffusion/controller/DiffusionLastModifiedController.php
@@ -1,156 +1,136 @@
<?php
final class DiffusionLastModifiedController extends DiffusionController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$paths = $request->getStr('paths');
try {
$paths = phutil_json_decode($paths);
} catch (PhutilJSONParserException $ex) {
return new Aphront400Response();
}
$modified_map = $this->callConduitWithDiffusionRequest(
'diffusion.lastmodifiedquery',
array(
'paths' => array_fill_keys($paths, $drequest->getCommit()),
));
if ($modified_map) {
$commit_map = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withRepository($drequest->getRepository())
->withIdentifiers(array_values($modified_map))
->needCommitData(true)
->needIdentities(true)
->execute();
$commit_map = mpull($commit_map, null, 'getCommitIdentifier');
} else {
$commit_map = array();
}
$commits = array();
foreach ($paths as $path) {
$modified_at = idx($modified_map, $path);
if ($modified_at) {
$commit = idx($commit_map, $modified_at);
if ($commit) {
$commits[$path] = $commit;
}
}
}
- $phids = array();
- foreach ($commits as $commit) {
- $phids[] = $commit->getCommitterDisplayPHID();
- $phids[] = $commit->getAuthorDisplayPHID();
- }
- $phids = array_filter($phids);
- $handles = $this->loadViewerHandles($phids);
-
$branch = $drequest->loadBranch();
if ($branch && $commits) {
$lint_query = id(new DiffusionLintCountQuery())
->withBranchIDs(array($branch->getID()))
->withPaths(array_keys($commits));
if ($drequest->getLint()) {
$lint_query->withCodes(array($drequest->getLint()));
}
$lint = $lint_query->execute();
} else {
$lint = array();
}
$output = array();
foreach ($commits as $path => $commit) {
$prequest = clone $drequest;
$prequest->setPath($path);
$output[$path] = $this->renderColumns(
$prequest,
- $handles,
$commit,
idx($lint, $path));
}
return id(new AphrontAjaxResponse())->setContent($output);
}
private function renderColumns(
DiffusionRequest $drequest,
- array $handles,
PhabricatorRepositoryCommit $commit = null,
$lint = null) {
- assert_instances_of($handles, 'PhabricatorObjectHandle');
- $viewer = $this->getRequest()->getUser();
+ $viewer = $this->getViewer();
if ($commit) {
$epoch = $commit->getEpoch();
$modified = DiffusionView::linkCommit(
$drequest->getRepository(),
$commit->getCommitIdentifier());
$date = $viewer->formatShortDateTime($epoch);
} else {
$modified = '';
$date = '';
}
- $author = $commit->renderAuthor($viewer, $handles);
- $committer = $commit->renderCommitter($viewer, $handles);
-
- if ($author != $committer) {
- $author = hsprintf('%s/%s', $author, $committer);
- }
-
$data = $commit->getCommitData();
$details = DiffusionView::linkDetail(
$drequest->getRepository(),
$commit->getCommitIdentifier(),
$data->getSummary());
$details = AphrontTableView::renderSingleDisplayLine($details);
-
$return = array(
'commit' => $modified,
'date' => $date,
- 'author' => $author,
'details' => $details,
);
if ($lint !== null) {
$return['lint'] = phutil_tag(
'a',
array(
'href' => $drequest->generateURI(array(
'action' => 'lint',
'lint' => null,
)),
),
number_format($lint));
}
// The client treats these results as markup, so make sure they have been
// escaped correctly.
foreach ($return as $key => $value) {
$return[$key] = hsprintf('%s', $value);
}
return $return;
}
}
diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php
index ffbfe8986f..57af6a0bdf 100644
--- a/src/applications/diffusion/view/DiffusionBrowseTableView.php
+++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php
@@ -1,146 +1,145 @@
<?php
final class DiffusionBrowseTableView extends DiffusionView {
private $paths;
private $handles = array();
public function setPaths(array $paths) {
assert_instances_of($paths, 'DiffusionRepositoryPath');
$this->paths = $paths;
return $this;
}
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function render() {
$request = $this->getDiffusionRequest();
$repository = $request->getRepository();
require_celerity_resource('diffusion-css');
$base_path = trim($request->getPath(), '/');
if ($base_path) {
$base_path = $base_path.'/';
}
$need_pull = array();
$rows = array();
$show_edit = false;
foreach ($this->paths as $path) {
$full_path = $base_path.$path->getPath();
$dir_slash = null;
$file_type = $path->getFileType();
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
$browse_text = $path->getPath().'/';
$dir_slash = '/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
$full_path.$dir_slash,
array(
'type' => $file_type,
'name' => $browse_text,
)));
$history_path = $full_path.'/';
} else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) {
$browse_text = $path->getPath().'/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse(
null,
array(
'type' => $file_type,
'name' => $browse_text,
'hash' => $path->getHash(),
'external' => $path->getExternalURI(),
)));
$history_path = $full_path.'/';
} else {
$browse_text = $path->getPath();
$browse_link = $this->linkBrowse(
$full_path,
array(
'type' => $file_type,
'name' => $browse_text,
));
$history_path = $full_path;
}
$history_link = $this->linkHistory($history_path);
$dict = array(
'lint' => celerity_generate_unique_node_id(),
'date' => celerity_generate_unique_node_id(),
- 'author' => celerity_generate_unique_node_id(),
'details' => celerity_generate_unique_node_id(),
);
$need_pull[$full_path.$dir_slash] = $dict;
foreach ($dict as $k => $uniq) {
$dict[$k] = phutil_tag('span', array('id' => $uniq), '');
}
$rows[] = array(
$browse_link,
idx($dict, 'lint'),
$dict['details'],
$dict['date'],
$history_link,
);
}
if ($need_pull) {
Javelin::initBehavior(
'diffusion-pull-lastmodified',
array(
'uri' => (string)$request->generateURI(
array(
'action' => 'lastmodified',
'stable' => true,
)),
'map' => $need_pull,
));
}
$branch = $this->getDiffusionRequest()->loadBranch();
$show_lint = ($branch && $branch->getLintCommit());
$lint = $request->getLint();
$view = new AphrontTableView($rows);
$view->setColumnClasses(
array(
'',
'',
'wide commit-detail',
'right',
'right narrow',
));
$view->setColumnVisibility(
array(
true,
$show_lint,
true,
true,
true,
));
$view->setDeviceVisibility(
array(
true,
false,
false,
false,
false,
));
return phutil_tag_div('diffusion-browse-table', $view->render());
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Nov 27, 12:34 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1263
Default Alt Text
(8 KB)

Event Timeline