mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Add on betwen comment action and noun in comments messages from git integrations.
Improve English grammar in comment messages in git integrations by adding 'on' between comment action and noun (PR, Issue, Commit).
This commit is contained in:
@@ -46,7 +46,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
|
||||
def test_bitbucket2_on_commit_comment_created_event(self):
|
||||
# type: () -> None
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74#comment-3354963) [Commit](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74)\n\n~~~ quote\nNice fix!\n~~~"
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74#comment-3354963) on [Commit](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74)\n\n~~~ quote\nNice fix!\n~~~"
|
||||
self.send_and_test_stream_message('v2_commit_comment_created', self.EXPECTED_SUBJECT, expected_message)
|
||||
|
||||
def test_bitbucket2_on_commit_status_changed_event(self):
|
||||
@@ -66,7 +66,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
|
||||
def test_bitbucket2_on_issue_commented_event(self):
|
||||
# type: () -> None
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/issues/2#comment-28973596) [Issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/issues/2#comment-28973596) on [Issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
||||
self.send_and_test_stream_message('v2_issue_commented', self.EXPECTED_SUBJECT_ISSUE_EVENTS, expected_message)
|
||||
|
||||
def test_bitbucket2_on_pull_request_created_event(self):
|
||||
@@ -119,7 +119,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
|
||||
def test_bitbucket2_on_pull_request_comment_created_event(self):
|
||||
# type: () -> None
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
expected_message = u"kolaszek [commented](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) on [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
kwargs = {
|
||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_created'
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
|
||||
def test_bitbucket2_on_pull_request_comment_updated_event(self):
|
||||
# type: () -> None
|
||||
expected_message = u"kolaszek updated [comment](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
expected_message = u"kolaszek updated [comment](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) on [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
kwargs = {
|
||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_updated'
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
|
||||
def test_bitbucket2_on_pull_request_comment_deleted_event(self):
|
||||
# type: () -> None
|
||||
expected_message = u"kolaszek deleted [comment](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
expected_message = u"kolaszek deleted [comment](https://bitbucket.org/kolaszek/repository-name/pull-requests/3/_/diff#comment-20576503) on [PR](https://bitbucket.org/kolaszek/repository-name/pull-requests/3)\n\n~~~ quote\nComment1\n~~~"
|
||||
kwargs = {
|
||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_deleted'
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class GithubV1HookTests(WebhookTestCase):
|
||||
# type: () -> None
|
||||
self.basic_test('issue_comment', 'issues',
|
||||
"zulip-test / Issue #5 The frobnicator doesn't work",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/issues/5#issuecomment-23374280) [Issue](https://github.com/zbenjamin/zulip-test/issues/5)\n\n~~~ quote\nWhoops, I did something wrong.\r\n\r\nI'm sorry.\n~~~")
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/issues/5#issuecomment-23374280) on [Issue](https://github.com/zbenjamin/zulip-test/issues/5)\n\n~~~ quote\nWhoops, I did something wrong.\r\n\r\nI'm sorry.\n~~~")
|
||||
|
||||
def test_issues_closed(self):
|
||||
# type: () -> None
|
||||
@@ -125,13 +125,13 @@ class GithubV1HookTests(WebhookTestCase):
|
||||
# type: () -> None
|
||||
self.basic_test('pull_request_comment', 'commits',
|
||||
"zulip-test / PR #9 Less cowbell.",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~")
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) on [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~")
|
||||
|
||||
def test_pull_request_comment_user_specified_stream(self):
|
||||
# type: () -> None
|
||||
self.basic_test('pull_request_comment', 'my_commits',
|
||||
"zulip-test / PR #9 Less cowbell.",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) on [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~",
|
||||
send_stream=True)
|
||||
|
||||
def test_commit_comment(self):
|
||||
@@ -236,7 +236,7 @@ class GithubV2HookTests(WebhookTestCase):
|
||||
# type: () -> None
|
||||
self.basic_test('issue_comment', 'issues',
|
||||
"zulip-test / Issue #5 The frobnicator doesn't work",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/issues/5#issuecomment-23374280) [Issue](https://github.com/zbenjamin/zulip-test/issues/5)\n\n~~~ quote\nWhoops, I did something wrong.\r\n\r\nI'm sorry.\n~~~")
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/issues/5#issuecomment-23374280) on [Issue](https://github.com/zbenjamin/zulip-test/issues/5)\n\n~~~ quote\nWhoops, I did something wrong.\r\n\r\nI'm sorry.\n~~~")
|
||||
|
||||
def test_issues_closed(self):
|
||||
# type: () -> None
|
||||
@@ -267,13 +267,13 @@ class GithubV2HookTests(WebhookTestCase):
|
||||
# type: () -> None
|
||||
self.basic_test('pull_request_comment', 'commits',
|
||||
"zulip-test / PR #9 Less cowbell.",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~")
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) on [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~")
|
||||
|
||||
def test_pull_request_comment_user_specified_stream(self):
|
||||
# type: () -> None
|
||||
self.basic_test('pull_request_comment', 'my_commits',
|
||||
"zulip-test / PR #9 Less cowbell.",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~",
|
||||
"zbenjamin [commented](https://github.com/zbenjamin/zulip-test/pull/9#issuecomment-24771110) on [PR](https://github.com/zbenjamin/zulip-test/pull/9)\n\n~~~ quote\nYeah, who really needs more cowbell than we already have?\n~~~",
|
||||
send_stream=True)
|
||||
|
||||
def test_commit_comment(self):
|
||||
|
||||
@@ -117,7 +117,7 @@ class GitlabHookTests(WebhookTestCase):
|
||||
def test_note_commit_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7#note_14169211) [Commit](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7)\n\n~~~ quote\nnice commit\n~~~"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7#note_14169211) on [Commit](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7)\n\n~~~ quote\nnice commit\n~~~"
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'commit_note',
|
||||
@@ -129,7 +129,7 @@ class GitlabHookTests(WebhookTestCase):
|
||||
def test_note_merge_request_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"my-awesome-project / MR #1 Tomek"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1#note_14171860) [MR](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1)\n\n~~~ quote\nNice merge request!\n~~~"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1#note_14171860) on [MR](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1)\n\n~~~ quote\nNice merge request!\n~~~"
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_note',
|
||||
@@ -141,7 +141,7 @@ class GitlabHookTests(WebhookTestCase):
|
||||
def test_note_issue_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"my-awesome-project / Issue #2 abc"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2#note_14172057) [Issue](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2)\n\n~~~ quote\nNice issue\n~~~"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2#note_14172057) on [Issue](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2)\n\n~~~ quote\nNice issue\n~~~"
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_note',
|
||||
@@ -153,7 +153,7 @@ class GitlabHookTests(WebhookTestCase):
|
||||
def test_note_snippet_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"my-awesome-project / Snippet #2 test"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2#note_14172058) [Snippet](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2)\n\n~~~ quote\nNice snippet\n~~~"
|
||||
expected_message = u"Tomasz Kolek [commented](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2#note_14172058) on [Snippet](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2)\n\n~~~ quote\nNice snippet\n~~~"
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'snippet_note',
|
||||
|
||||
@@ -168,7 +168,7 @@ def get_fork_body(payload):
|
||||
def get_commit_comment_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
comment = payload.get('comment')
|
||||
action = u'[commented]({})'.format(comment['links']['html']['href'])
|
||||
action = u'[commented]({}) on'.format(comment['links']['html']['href'])
|
||||
return get_pull_request_event_message(
|
||||
get_user_username(payload),
|
||||
action,
|
||||
@@ -194,7 +194,7 @@ def get_commit_status_changed_body(payload):
|
||||
|
||||
def get_issue_commented_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
action = '[commented]({})'.format(payload['comment']['links']['html']['href'])
|
||||
action = '[commented]({}) on'.format(payload['comment']['links']['html']['href'])
|
||||
return get_issue_action_body(payload, action)
|
||||
|
||||
def get_issue_action_body(payload, action):
|
||||
@@ -253,6 +253,7 @@ def get_pull_request_deleted_or_updated_comment_action_body(payload, action):
|
||||
|
||||
def get_pull_request_comment_action_body(payload, action):
|
||||
# type: (Dict[str, Any], str) -> text_type
|
||||
action += ' on'
|
||||
return get_pull_request_event_message(
|
||||
get_user_username(payload),
|
||||
action,
|
||||
|
||||
@@ -72,7 +72,7 @@ def github_object_commented_content(payload, type):
|
||||
# type: (Mapping[text_type, Any], text_type) -> text_type
|
||||
comment = payload['comment']
|
||||
issue = payload['issue']
|
||||
action = u'[commented]({})'.format(comment['html_url'])
|
||||
action = u'[commented]({}) on'.format(comment['html_url'])
|
||||
|
||||
return get_pull_request_event_message(
|
||||
comment['user']['login'],
|
||||
|
||||
@@ -119,7 +119,7 @@ def get_objects_assignee(payload):
|
||||
def get_commented_commit_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
comment = payload.get('object_attributes')
|
||||
action = u'[commented]({})'.format(comment['url'])
|
||||
action = u'[commented]({}) on'.format(comment['url'])
|
||||
return get_pull_request_event_message(
|
||||
get_issue_user_name(payload),
|
||||
action,
|
||||
@@ -131,7 +131,7 @@ def get_commented_commit_event_body(payload):
|
||||
def get_commented_merge_request_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
comment = payload.get('object_attributes')
|
||||
action = u'[commented]({})'.format(comment['url'])
|
||||
action = u'[commented]({}) on'.format(comment['url'])
|
||||
url = u'{}/merge_requests/{}'.format(
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('merge_request').get('iid')
|
||||
@@ -147,7 +147,7 @@ def get_commented_merge_request_event_body(payload):
|
||||
def get_commented_issue_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
comment = payload.get('object_attributes')
|
||||
action = u'[commented]({})'.format(comment['url'])
|
||||
action = u'[commented]({}) on'.format(comment['url'])
|
||||
url = u'{}/issues/{}'.format(
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('issue').get('iid')
|
||||
@@ -163,7 +163,7 @@ def get_commented_issue_event_body(payload):
|
||||
def get_commented_snippet_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
comment = payload.get('object_attributes')
|
||||
action = u'[commented]({})'.format(comment['url'])
|
||||
action = u'[commented]({}) on'.format(comment['url'])
|
||||
url = u'{}/snippets/{}'.format(
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('snippet').get('id')
|
||||
|
||||
Reference in New Issue
Block a user