diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3fa9b2e25e..28e808026a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -502,6 +502,7 @@ phutil_register_library_map(array( 'DifferentialReviewersCommitMessageField' => 'applications/differential/field/DifferentialReviewersCommitMessageField.php', 'DifferentialReviewersField' => 'applications/differential/customfield/DifferentialReviewersField.php', 'DifferentialReviewersHeraldAction' => 'applications/differential/herald/DifferentialReviewersHeraldAction.php', + 'DifferentialReviewersSearchEngineAttachment' => 'applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php', 'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php', 'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php', 'DifferentialRevisionAbandonTransaction' => 'applications/differential/xaction/DifferentialRevisionAbandonTransaction.php', @@ -5275,6 +5276,7 @@ phutil_register_library_map(array( 'DifferentialReviewersCommitMessageField' => 'DifferentialCommitMessageField', 'DifferentialReviewersField' => 'DifferentialCoreCustomField', 'DifferentialReviewersHeraldAction' => 'HeraldAction', + 'DifferentialReviewersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 'DifferentialReviewersView' => 'AphrontView', 'DifferentialRevision' => array( 'DifferentialDAO', diff --git a/src/applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php b/src/applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php new file mode 100644 index 0000000000..33fb606a60 --- /dev/null +++ b/src/applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php @@ -0,0 +1,41 @@ +needReviewers(true); + } + + public function getAttachmentForObject($object, $data, $spec) { + $reviewers = $object->getReviewers(); + + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; + + $list = array(); + foreach ($reviewers as $reviewer) { + $status = $reviewer->getReviewerStatus(); + $is_blocking = ($status == $status_blocking); + + $list[] = array( + 'reviewerPHID' => $reviewer->getReviewerPHID(), + 'status' => $status, + 'isBlocking' => $is_blocking, + 'actorPHID' => $reviewer->getLastActorPHID(), + ); + } + + return array( + 'reviewers' => $list, + ); + } + +} diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 72204256e5..0e968dccf4 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -907,7 +907,10 @@ final class DifferentialRevision extends DifferentialDAO } public function getConduitSearchAttachments() { - return array(); + return array( + id(new DifferentialReviewersSearchEngineAttachment()) + ->setAttachmentKey('reviewers'), + ); }