1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +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:
epriestley 2021-03-09 14:38:03 -08:00
parent bfe7cdc5a2
commit 55532b3f74
3 changed files with 39 additions and 1 deletions

View file

@ -724,6 +724,7 @@ phutil_register_library_map(array(
'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php',
'DiffusionAuditorsAddSelfHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php',
'DiffusionAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsHeraldAction.php',
'DiffusionAuditorsSearchEngineAttachment' => 'applications/diffusion/engineextension/DiffusionAuditorsSearchEngineAttachment.php',
'DiffusionBlameConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBlameConduitAPIMethod.php',
'DiffusionBlameController' => 'applications/diffusion/controller/DiffusionBlameController.php',
'DiffusionBlameQuery' => 'applications/diffusion/query/blame/DiffusionBlameQuery.php',
@ -6843,6 +6844,7 @@ phutil_register_library_map(array(
'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction',
'DiffusionAuditorsAddSelfHeraldAction' => 'DiffusionAuditorsHeraldAction',
'DiffusionAuditorsHeraldAction' => 'HeraldAction',
'DiffusionAuditorsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'DiffusionBlameConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBlameController' => 'DiffusionController',
'DiffusionBlameQuery' => 'DiffusionQuery',

View file

@ -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,
);
}
}

View file

@ -945,7 +945,10 @@ final class PhabricatorRepositoryCommit
}
public function getConduitSearchAttachments() {
return array();
return array(
id(new DiffusionAuditorsSearchEngineAttachment())
->setAttachmentKey('auditors'),
);
}