Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14835144
D17633.id42404.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D17633.id42404.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -502,6 +502,7 @@
'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 @@
'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
--- /dev/null
+++ b/src/applications/differential/engineextension/DifferentialReviewersSearchEngineAttachment.php
@@ -0,0 +1,51 @@
+<?php
+
+final class DifferentialReviewersSearchEngineAttachment
+ extends PhabricatorSearchEngineAttachment {
+
+ public function getAttachmentName() {
+ return pht('Differential Reviewers');
+ }
+
+ public function getAttachmentDescription() {
+ return pht('Get the reviewers for each revision.');
+ }
+
+ public function willLoadAttachmentData($query, $spec) {
+ $query
+ ->needReviewers(true)
+ ->needActiveDiffs(true);
+ }
+
+ public function getAttachmentForObject($object, $data, $spec) {
+ $reviewers = $object->getReviewers();
+ $diff_phid = $object->getActiveDiff()->getPHID();
+
+ $list = array();
+ foreach ($reviewers as $reviewer) {
+ switch ($reviewer->getReviewerStatus()) {
+ case DifferentialReviewerStatus::STATUS_ACCEPTED:
+ $is_current = $reviewer->isAccepted($diff_phid);
+ break;
+ case DifferentialReviewerStatus::STATUS_REJECTED:
+ $is_current = $reviewer->isRejected($diff_phid);
+ break;
+ default:
+ $is_current = null;
+ break;
+ }
+
+ $list[] = array(
+ 'reviewerPHID' => $reviewer->getReviewerPHID(),
+ 'status' => $reviewer->getReviewerStatus(),
+ 'actorPHID' => $reviewer->getLastActorPHID(),
+ 'isCurrent' => $is_current,
+ );
+ }
+
+ return array(
+ 'reviewers' => $list,
+ );
+ }
+
+}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -907,7 +907,10 @@
}
public function getConduitSearchAttachments() {
- return array();
+ return array(
+ id(new DifferentialReviewersSearchEngineAttachment())
+ ->setAttachmentKey('reviewers'),
+ );
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 7:09 PM (6 h, 9 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7079498
Default Alt Text
D17633.id42404.diff (3 KB)
Attached To
Mode
D17633: Provide a "Reviewers" attachment to "differential.revision.search"
Attached
Detach File
Event Timeline
Log In to Comment