diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f031f7deca..849d4d4702 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -696,6 +696,7 @@ phutil_register_library_map(array( 'DiffusionCommitRevertsCommitEdgeType' => 'applications/diffusion/edge/DiffusionCommitRevertsCommitEdgeType.php', 'DiffusionCommitReviewerHeraldField' => 'applications/diffusion/herald/DiffusionCommitReviewerHeraldField.php', 'DiffusionCommitRevisionAcceptedHeraldField' => 'applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php', + 'DiffusionCommitRevisionAcceptingReviewersHeraldField' => 'applications/diffusion/herald/DiffusionCommitRevisionAcceptingReviewersHeraldField.php', 'DiffusionCommitRevisionHeraldField' => 'applications/diffusion/herald/DiffusionCommitRevisionHeraldField.php', 'DiffusionCommitRevisionReviewersHeraldField' => 'applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php', 'DiffusionCommitRevisionSubscribersHeraldField' => 'applications/diffusion/herald/DiffusionCommitRevisionSubscribersHeraldField.php', @@ -809,6 +810,7 @@ phutil_register_library_map(array( 'DiffusionPreCommitContentRepositoryHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRepositoryHeraldField.php', 'DiffusionPreCommitContentRepositoryProjectsHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRepositoryProjectsHeraldField.php', 'DiffusionPreCommitContentRevisionAcceptedHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php', + 'DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField.php', 'DiffusionPreCommitContentRevisionHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionHeraldField.php', 'DiffusionPreCommitContentRevisionReviewersHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php', 'DiffusionPreCommitContentRevisionSubscribersHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php', @@ -5755,6 +5757,7 @@ phutil_register_library_map(array( 'DiffusionCommitRevertsCommitEdgeType' => 'PhabricatorEdgeType', 'DiffusionCommitReviewerHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitRevisionAcceptedHeraldField' => 'DiffusionCommitHeraldField', + 'DiffusionCommitRevisionAcceptingReviewersHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitRevisionHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitRevisionReviewersHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitRevisionSubscribersHeraldField' => 'DiffusionCommitHeraldField', @@ -5871,6 +5874,7 @@ phutil_register_library_map(array( 'DiffusionPreCommitContentRepositoryHeraldField' => 'DiffusionPreCommitContentHeraldField', 'DiffusionPreCommitContentRepositoryProjectsHeraldField' => 'DiffusionPreCommitContentHeraldField', 'DiffusionPreCommitContentRevisionAcceptedHeraldField' => 'DiffusionPreCommitContentHeraldField', + 'DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField' => 'DiffusionPreCommitContentHeraldField', 'DiffusionPreCommitContentRevisionHeraldField' => 'DiffusionPreCommitContentHeraldField', 'DiffusionPreCommitContentRevisionReviewersHeraldField' => 'DiffusionPreCommitContentHeraldField', 'DiffusionPreCommitContentRevisionSubscribersHeraldField' => 'DiffusionPreCommitContentHeraldField', diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptingReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptingReviewersHeraldField.php new file mode 100644 index 0000000000..6d266f1357 --- /dev/null +++ b/src/applications/diffusion/herald/DiffusionCommitRevisionAcceptingReviewersHeraldField.php @@ -0,0 +1,43 @@ +getAdapter()->loadDifferentialRevision(); + + if (!$revision) { + return array(); + } + + $diff_phid = $revision->getActiveDiffPHID(); + + $reviewer_phids = array(); + foreach ($revision->getReviewers() as $reviewer) { + if ($reviewer->isAccepted($diff_phid)) { + $reviewer_phids[] = $reviewer->getReviewerPHID(); + } + } + + return $reviewer_phids; + } + + protected function getHeraldFieldStandardType() { + return self::STANDARD_PHID_LIST; + } + + protected function getDatasource() { + return new DifferentialReviewerDatasource(); + } + +} diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php index 50900ede78..a9a3f3e8ca 100644 --- a/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php +++ b/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php @@ -28,7 +28,7 @@ final class DiffusionCommitRevisionReviewersHeraldField } protected function getDatasource() { - return new PhabricatorProjectOrUserDatasource(); + return new DifferentialReviewerDatasource(); } } diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField.php new file mode 100644 index 0000000000..b6d50d4a2a --- /dev/null +++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptingReviewersHeraldField.php @@ -0,0 +1,43 @@ +getAdapter()->getRevision(); + + if (!$revision) { + return array(); + } + + $diff_phid = $revision->getActiveDiffPHID(); + + $reviewer_phids = array(); + foreach ($revision->getReviewers() as $reviewer) { + if ($reviewer->isAccepted($diff_phid)) { + $reviewer_phids[] = $reviewer->getReviewerPHID(); + } + } + + return $reviewer_phids; + } + + protected function getHeraldFieldStandardType() { + return self::STANDARD_PHID_LIST; + } + + protected function getDatasource() { + return new DifferentialReviewerDatasource(); + } + +} diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php index 936126ba89..aa2b2e9e09 100644 --- a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php +++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php @@ -28,7 +28,7 @@ final class DiffusionPreCommitContentRevisionReviewersHeraldField } protected function getDatasource() { - return new PhabricatorProjectOrUserDatasource(); + return new DifferentialReviewerDatasource(); } }