mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 19:31:02 +01:00
Move audit rendering into SearchEngine
Summary: Ref T4986. Updates audit. Slightly tweaks on method visibility. Just used a HandleQuery since we have to rebuild the whole view thing otherwise; this is an unusual case. Test Plan: - Checked Audit. - Checked Feed. - Checked Slowvote. {F151555} Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9011
This commit is contained in:
parent
8f42f4b538
commit
c72b753e54
5 changed files with 36 additions and 25 deletions
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorAuditListController
|
final class PhabricatorAuditListController
|
||||||
extends PhabricatorAuditController
|
extends PhabricatorAuditController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
private $name;
|
private $name;
|
||||||
|
@ -26,23 +25,4 @@ final class PhabricatorAuditListController
|
||||||
return $this->delegateToController($controller);
|
return $this->delegateToController($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultsList(
|
|
||||||
array $commits,
|
|
||||||
PhabricatorSavedQuery $query) {
|
|
||||||
assert_instances_of($commits, 'PhabricatorRepositoryCommit');
|
|
||||||
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
$nodata = pht('No matching audits.');
|
|
||||||
$view = id(new PhabricatorAuditListView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setCommits($commits)
|
|
||||||
->setAuthorityPHIDs(
|
|
||||||
PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer))
|
|
||||||
->setNoDataString($nodata);
|
|
||||||
|
|
||||||
$phids = $view->getRequiredHandlePHIDs();
|
|
||||||
$handles = $this->loadViewerHandles($phids);
|
|
||||||
$view->setHandles($handles);
|
|
||||||
return $view->buildList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,4 +159,35 @@ final class PhabricatorCommitSearchEngine
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderResultList(
|
||||||
|
array $commits,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
|
||||||
|
assert_instances_of($commits, 'PhabricatorRepositoryCommit');
|
||||||
|
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
$nodata = pht('No matching audits.');
|
||||||
|
$view = id(new PhabricatorAuditListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setCommits($commits)
|
||||||
|
->setAuthorityPHIDs(
|
||||||
|
PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer))
|
||||||
|
->setNoDataString($nodata);
|
||||||
|
|
||||||
|
$phids = $view->getRequiredHandlePHIDs();
|
||||||
|
if ($phids) {
|
||||||
|
$handles = id(new PhabricatorHandleQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withPHIDs($phids)
|
||||||
|
->execute();
|
||||||
|
} else {
|
||||||
|
$handles = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$view->setHandles($handles);
|
||||||
|
|
||||||
|
return $view->buildList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ final class PhabricatorFeedSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
return parent::buildSavedQueryFromBuiltin($query_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultList(
|
protected function renderResultList(
|
||||||
array $objects,
|
array $objects,
|
||||||
PhabricatorSavedQuery $query,
|
PhabricatorSavedQuery $query,
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
|
@ -576,13 +576,13 @@ abstract class PhabricatorApplicationSearchEngine {
|
||||||
return $this->renderResultList($objects, $query, $handles);
|
return $this->renderResultList($objects, $query, $handles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredHandlePHIDsForResultList(
|
protected function getRequiredHandlePHIDsForResultList(
|
||||||
array $objects,
|
array $objects,
|
||||||
PhabricatorSavedQuery $query) {
|
PhabricatorSavedQuery $query) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultList(
|
protected function renderResultList(
|
||||||
array $objects,
|
array $objects,
|
||||||
PhabricatorSavedQuery $query,
|
PhabricatorSavedQuery $query,
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ final class PhabricatorSlowvoteSearchEngine
|
||||||
return mpull($polls, 'getAuthorPHID');
|
return mpull($polls, 'getAuthorPHID');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResultList(
|
protected function renderResultList(
|
||||||
array $polls,
|
array $polls,
|
||||||
PhabricatorSavedQuery $query,
|
PhabricatorSavedQuery $query,
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
Loading…
Reference in a new issue