mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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
|
||||
|
||||
final class PhabricatorAuditListController
|
||||
extends PhabricatorAuditController
|
||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
||||
extends PhabricatorAuditController {
|
||||
|
||||
private $queryKey;
|
||||
private $name;
|
||||
|
@ -26,23 +25,4 @@ final class PhabricatorAuditListController
|
|||
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);
|
||||
}
|
||||
|
||||
public function renderResultList(
|
||||
protected function renderResultList(
|
||||
array $objects,
|
||||
PhabricatorSavedQuery $query,
|
||||
array $handles) {
|
||||
|
|
|
@ -576,13 +576,13 @@ abstract class PhabricatorApplicationSearchEngine {
|
|||
return $this->renderResultList($objects, $query, $handles);
|
||||
}
|
||||
|
||||
public function getRequiredHandlePHIDsForResultList(
|
||||
protected function getRequiredHandlePHIDsForResultList(
|
||||
array $objects,
|
||||
PhabricatorSavedQuery $query) {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function renderResultList(
|
||||
protected function renderResultList(
|
||||
array $objects,
|
||||
PhabricatorSavedQuery $query,
|
||||
array $handles) {
|
||||
|
|
|
@ -121,7 +121,7 @@ final class PhabricatorSlowvoteSearchEngine
|
|||
return mpull($polls, 'getAuthorPHID');
|
||||
}
|
||||
|
||||
public function renderResultList(
|
||||
protected function renderResultList(
|
||||
array $polls,
|
||||
PhabricatorSavedQuery $query,
|
||||
array $handles) {
|
||||
|
|
Loading…
Reference in a new issue