mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Add a very basic "auditors" attachment to "differential.commit.search"
Summary: Ref T13631. For now, this only shows the auditor PHID. The current status constants could use some cleanup before they're exposed. Test Plan: Queried with "auditors" attachment, saw basic auditor information. Maniphest Tasks: T13631 Differential Revision: https://secure.phabricator.com/D21597
This commit is contained in:
parent
bfe7cdc5a2
commit
55532b3f74
3 changed files with 39 additions and 1 deletions
|
@ -724,6 +724,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php',
|
'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php',
|
||||||
'DiffusionAuditorsAddSelfHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php',
|
'DiffusionAuditorsAddSelfHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php',
|
||||||
'DiffusionAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsHeraldAction.php',
|
'DiffusionAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsHeraldAction.php',
|
||||||
|
'DiffusionAuditorsSearchEngineAttachment' => 'applications/diffusion/engineextension/DiffusionAuditorsSearchEngineAttachment.php',
|
||||||
'DiffusionBlameConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBlameConduitAPIMethod.php',
|
'DiffusionBlameConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBlameConduitAPIMethod.php',
|
||||||
'DiffusionBlameController' => 'applications/diffusion/controller/DiffusionBlameController.php',
|
'DiffusionBlameController' => 'applications/diffusion/controller/DiffusionBlameController.php',
|
||||||
'DiffusionBlameQuery' => 'applications/diffusion/query/blame/DiffusionBlameQuery.php',
|
'DiffusionBlameQuery' => 'applications/diffusion/query/blame/DiffusionBlameQuery.php',
|
||||||
|
@ -6843,6 +6844,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction',
|
'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction',
|
||||||
'DiffusionAuditorsAddSelfHeraldAction' => 'DiffusionAuditorsHeraldAction',
|
'DiffusionAuditorsAddSelfHeraldAction' => 'DiffusionAuditorsHeraldAction',
|
||||||
'DiffusionAuditorsHeraldAction' => 'HeraldAction',
|
'DiffusionAuditorsHeraldAction' => 'HeraldAction',
|
||||||
|
'DiffusionAuditorsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
|
||||||
'DiffusionBlameConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
'DiffusionBlameConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
||||||
'DiffusionBlameController' => 'DiffusionController',
|
'DiffusionBlameController' => 'DiffusionController',
|
||||||
'DiffusionBlameQuery' => 'DiffusionQuery',
|
'DiffusionBlameQuery' => 'DiffusionQuery',
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionAuditorsSearchEngineAttachment
|
||||||
|
extends PhabricatorSearchEngineAttachment {
|
||||||
|
|
||||||
|
public function getAttachmentName() {
|
||||||
|
return pht('Diffusion Auditors');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAttachmentDescription() {
|
||||||
|
return pht('Get the auditors for each commit.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function willLoadAttachmentData($query, $spec) {
|
||||||
|
$query->needAuditRequests(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAttachmentForObject($object, $data, $spec) {
|
||||||
|
$auditors = $object->getAudits();
|
||||||
|
|
||||||
|
$list = array();
|
||||||
|
foreach ($auditors as $auditor) {
|
||||||
|
$list[] = array(
|
||||||
|
'auditorPHID' => $auditor->getAuditorPHID(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'auditors' => $list,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -945,7 +945,10 @@ final class PhabricatorRepositoryCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConduitSearchAttachments() {
|
public function getConduitSearchAttachments() {
|
||||||
return array();
|
return array(
|
||||||
|
id(new DiffusionAuditorsSearchEngineAttachment())
|
||||||
|
->setAttachmentKey('auditors'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue