Skip to content

Commit

Permalink
integrations: Use correct type for GitHub pull request comment messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbansal1999 authored and timabbott committed Nov 22, 2023
1 parent d2589a5 commit cda7ed7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion zerver/webhooks/github/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_issue_comment_msg_with_custom_topic_in_url(self) -> None:
self.check_webhook("issue_comment", expected_topic, expected_message)

def test_issue_comment_pull_request_comment_msg(self) -> None:
expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [issue #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~"
expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [PR #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~"
self.check_webhook("issue_comment__pull_request_comment", TOPIC_PR, expected_message)

def test_issue_msg(self) -> None:
Expand Down
3 changes: 2 additions & 1 deletion zerver/webhooks/github/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ def get_issue_comment_body(helper: Helper) -> str:
action = f"{action} a [comment]"
action += "({}) on".format(comment["html_url"].tame(check_string))

return get_issue_event_message(
return get_pull_request_event_message(
user_name=get_sender_name(payload),
action=action,
url=issue["html_url"].tame(check_string),
number=issue["number"].tame(check_int),
message=comment["body"].tame(check_string),
title=issue["title"].tame(check_string) if include_title else None,
type="PR" if is_pull_request_comment_event(payload) else "issue",
)


Expand Down

0 comments on commit cda7ed7

Please sign in to comment.