github: Rename `ReviewComment` in `PullComment`
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 11 Jul 2019 00:59:12 +0000 (20:59 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 11 Jul 2019 02:07:02 +0000 (22:07 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/github/api.nit
lib/github/events.nit
lib/github/hooks.nit
lib/github/tests/test_api.nit

index bb98665..597c05f 100644 (file)
@@ -370,8 +370,8 @@ class GithubAPI
        end
 
        # Get a specific pull request comment
-       fun get_pull_comment(repo_slug: String, id: Int): nullable ReviewComment do
-               return get("/repos/{repo_slug}/pulls/comments/{id}").as(nullable ReviewComment)
+       fun get_pull_comment(repo_slug: String, id: Int): nullable PullComment do
+               return get("/repos/{repo_slug}/pulls/comments/{id}").as(nullable PullComment)
        end
 
        # Get the Github label with `name`.
@@ -829,7 +829,7 @@ end
 #
 # * `CommitComment` are made on a commit page.
 # * `IssueComment` are made on an issue or pull request page.
-# * `ReviewComment` are made on the diff associated to a pull request.
+# * `PullComment` are made on the diff associated to a pull request.
 abstract class Comment
        serialize
 
@@ -942,7 +942,7 @@ end
 # Should be accessed from `GithubAPI::get_diff_comment`.
 #
 # See <https://developer.github.com/v3/pulls/comments/>.
-class ReviewComment
+class PullComment
        super Comment
        serialize
 
@@ -1085,7 +1085,7 @@ class GithubDeserializer
                map["{pattern_base}/repos/[^/]*/[^/]*/issues/comments/[0-9]+$".to_re] = "IssueComment"
                map["{pattern_base}/repos/[^/]*/[^/]*/issues/events/[0-9]+$".to_re] = "IssueEvent"
                map["{pattern_base}/repos/[^/]*/[^/]*/pulls/[0-9]+$".to_re] = "PullRequest"
-               map["{pattern_base}/repos/[^/]*/[^/]*/pulls/comments/[0-9]+$".to_re] = "ReviewComment"
+               map["{pattern_base}/repos/[^/]*/[^/]*/pulls/comments/[0-9]+$".to_re] = "PullComment"
                map["{pattern_base}/repos/[^/]*/[^/]*/comments/[0-9]+$".to_re] = "CommitComment"
                map["{pattern_base}/repos/[^/]*/[^/]*/commits/[a-f0-9]+$".to_re] = "Commit"
                map["{pattern_base}/repos/[^/]*/[^/]*/commits/[a-f0-9]+/status$".to_re] = "CommitStatus"
index f2f398a..952ee62 100644 (file)
@@ -185,12 +185,12 @@ class PullRequestEvent
 end
 
 # Triggered when a comment is created on a pull request diff.
-class PullRequestReviewCommentEvent
+class PullRequestPullCommentEvent
        super GithubEvent
        serialize
 
        # The `Comment` itself.
-       var comment: ReviewComment is writable
+       var comment: PullComment is writable
 
        # `PullRequest` the `comment` belongs to.
        var pull: PullRequest is writable
@@ -268,7 +268,7 @@ redef class GithubDeserializer
                else if json_object.has_key("action") and json_object.has_key("number") then
                        return "PullRequestEvent"
                else if json_object.has_key("action") and json_object.has_key("pull") and json_object.has_key("comment") then
-                       return "PullRequestReviewCommentEvent"
+                       return "PullRequestPullCommentEvent"
                else if json_object.has_key("head_commit") and json_object.has_key("commits") then
                        return "PushEvent"
                else if json_object.has_key("action") and json_object.has_key("branches") then
index bfd076d..945359f 100644 (file)
@@ -110,7 +110,7 @@ abstract class HookListener
                else if kind == "pull_request" then
                        return api.deserialize(json).as(PullRequestEvent)
                else if kind == "pull_request_review_comment" then
-                       return api.deserialize(json).as(PullRequestReviewCommentEvent)
+                       return api.deserialize(json).as(PullRequestPullCommentEvent)
                else if kind == "push" then
                        return api.deserialize(json).as(PushEvent)
                else if kind == "status" then
index 89d6960..1976877 100644 (file)
@@ -338,7 +338,7 @@ class TestGithubAPI
 
        fun test_get_pull_comment is test do
                var comment = api.get_pull_comment("nitlang/nit", 21010363)
-               assert comment isa ReviewComment
+               assert comment isa PullComment
                assert comment.path == "src/modelize/modelize_property.nit"
                assert comment.original_position == 26
                assert comment.pull_number == 945