@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide a "Reviewers" attachment to "differential.revision.search"

Summary: Allow API callers to retrieve reviewer information via a new "reviewers" attachment.

Test Plan: {F4675784}

Reviewers: chad, lvital

Reviewed By: lvital

Subscribers: lvital

Differential Revision: https://secure.phabricator.com/D17633

+47 -1
+2
src/__phutil_library_map__.php
··· 502 502 'DifferentialReviewersCommitMessageField' => 'applications/differential/field/DifferentialReviewersCommitMessageField.php', 503 503 'DifferentialReviewersField' => 'applications/differential/customfield/DifferentialReviewersField.php', 504 504 'DifferentialReviewersHeraldAction' => 'applications/differential/herald/DifferentialReviewersHeraldAction.php', 505 + 'DifferentialReviewersSearchEngineAttachment' => 'applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php', 505 506 'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php', 506 507 'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php', 507 508 'DifferentialRevisionAbandonTransaction' => 'applications/differential/xaction/DifferentialRevisionAbandonTransaction.php', ··· 5275 5276 'DifferentialReviewersCommitMessageField' => 'DifferentialCommitMessageField', 5276 5277 'DifferentialReviewersField' => 'DifferentialCoreCustomField', 5277 5278 'DifferentialReviewersHeraldAction' => 'HeraldAction', 5279 + 'DifferentialReviewersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 5278 5280 'DifferentialReviewersView' => 'AphrontView', 5279 5281 'DifferentialRevision' => array( 5280 5282 'DifferentialDAO',
+41
src/applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php
··· 1 + <?php 2 + 3 + final class DifferentialReviewersSearchEngineAttachment 4 + extends PhabricatorSearchEngineAttachment { 5 + 6 + public function getAttachmentName() { 7 + return pht('Differential Reviewers'); 8 + } 9 + 10 + public function getAttachmentDescription() { 11 + return pht('Get the reviewers for each revision.'); 12 + } 13 + 14 + public function willLoadAttachmentData($query, $spec) { 15 + $query->needReviewers(true); 16 + } 17 + 18 + public function getAttachmentForObject($object, $data, $spec) { 19 + $reviewers = $object->getReviewers(); 20 + 21 + $status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING; 22 + 23 + $list = array(); 24 + foreach ($reviewers as $reviewer) { 25 + $status = $reviewer->getReviewerStatus(); 26 + $is_blocking = ($status == $status_blocking); 27 + 28 + $list[] = array( 29 + 'reviewerPHID' => $reviewer->getReviewerPHID(), 30 + 'status' => $status, 31 + 'isBlocking' => $is_blocking, 32 + 'actorPHID' => $reviewer->getLastActorPHID(), 33 + ); 34 + } 35 + 36 + return array( 37 + 'reviewers' => $list, 38 + ); 39 + } 40 + 41 + }
+4 -1
src/applications/differential/storage/DifferentialRevision.php
··· 907 907 } 908 908 909 909 public function getConduitSearchAttachments() { 910 - return array(); 910 + return array( 911 + id(new DifferentialReviewersSearchEngineAttachment()) 912 + ->setAttachmentKey('reviewers'), 913 + ); 911 914 } 912 915 913 916