diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 5c8901836b..a534a3e965 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -104,6 +104,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_getcommitpaths_Method' => 'applications/conduit/method/differential/getcommitpaths', 'ConduitAPI_differential_getdiff_Method' => 'applications/conduit/method/differential/getdiff', 'ConduitAPI_differential_getrevision_Method' => 'applications/conduit/method/differential/getrevision', + 'ConduitAPI_differential_getrevisioncomments_Method' => 'applications/conduit/method/differential/getrevisioncomments', 'ConduitAPI_differential_getrevisionfeedback_Method' => 'applications/conduit/method/differential/getrevisionfeedback', 'ConduitAPI_differential_markcommitted_Method' => 'applications/conduit/method/differential/markcommitted', 'ConduitAPI_differential_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage', @@ -830,6 +831,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getdiff_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getrevision_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_getrevisioncomments_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_getrevisionfeedback_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_markcommitted_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', diff --git a/src/applications/conduit/method/differential/getrevisioncomments/ConduitAPI_differential_getrevisioncomments_Method.php b/src/applications/conduit/method/differential/getrevisioncomments/ConduitAPI_differential_getrevisioncomments_Method.php new file mode 100644 index 0000000000..86d64dc92b --- /dev/null +++ b/src/applications/conduit/method/differential/getrevisioncomments/ConduitAPI_differential_getrevisioncomments_Method.php @@ -0,0 +1,72 @@ + 'required list', + ); + } + + public function defineReturnType() { + return 'nonempty list>'; + } + + public function defineErrorTypes() { + return array( + ); + } + + protected function execute(ConduitAPIRequest $request) { + $results = array(); + $revision_ids = $request->getValue('ids'); + + if (!$revision_ids) { + return $results; + } + + $comments = id(new DifferentialComment())->loadAllWhere( + 'revisionID IN (%Ld)', + $revision_ids); + + foreach ($comments as $comment) { + $revision_id = $comment->getRevisionID(); + if (!array_key_exists($revision_id, $results)) { + $results[$revision_id] = array(); + } + $results[$revision_id][] = array( + 'revisionID' => $revision_id, + 'action' => $comment->getAction(), + 'authorPHID' => $comment->getAuthorPHID(), + 'dateCreated' => $comment->getDateCreated(), + 'content' => $comment->getContent(), + ); + } + + return $results; + } +} diff --git a/src/applications/conduit/method/differential/getrevisioncomments/__init__.php b/src/applications/conduit/method/differential/getrevisioncomments/__init__.php new file mode 100644 index 0000000000..dd846bae09 --- /dev/null +++ b/src/applications/conduit/method/differential/getrevisioncomments/__init__.php @@ -0,0 +1,15 @@ +