From 6f96139adcd1d028137e861859b215cfd43f5577 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 10 Jul 2019 20:59:12 -0400 Subject: [PATCH] github: Rename `ReviewComment` in `PullComment` Signed-off-by: Alexandre Terrasa --- lib/github/api.nit | 10 +++++----- lib/github/events.nit | 6 +++--- lib/github/hooks.nit | 2 +- lib/github/tests/test_api.nit | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/github/api.nit b/lib/github/api.nit index bb98665..597c05f 100644 --- a/lib/github/api.nit +++ b/lib/github/api.nit @@ -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 . -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" diff --git a/lib/github/events.nit b/lib/github/events.nit index f2f398a..952ee62 100644 --- a/lib/github/events.nit +++ b/lib/github/events.nit @@ -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 diff --git a/lib/github/hooks.nit b/lib/github/hooks.nit index bfd076d..945359f 100644 --- a/lib/github/hooks.nit +++ b/lib/github/hooks.nit @@ -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 diff --git a/lib/github/tests/test_api.nit b/lib/github/tests/test_api.nit index 89d6960..1976877 100644 --- a/lib/github/tests/test_api.nit +++ b/lib/github/tests/test_api.nit @@ -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 -- 1.7.9.5