Skip to content

Commit 81945df

Browse files
author
Karl Dubost
authored
Merge pull request #3525 from webcompat/issue/3522/1
Fixes #3522: Fix outreach comment for auth reports
2 parents 626fbf2 + cde0096 commit 81945df

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"action": "milestoned",
3+
"issue": {
4+
"url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/2598",
5+
"repository_url": "https://api.github.com/repos/webcompat/webcompat-tests",
6+
"labels_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/2598/labels{/name}",
7+
"comments_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/2598/comments",
8+
"events_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/2598/events",
9+
"html_url": "https://github.com/webcompat/webcompat-tests/issues/2598",
10+
"id": 735747598,
11+
"node_id": "MDU6SXNzdWU3MzU3NDc1OTg=",
12+
"number": 2598,
13+
"title": "bugzilla.mozilla.org - see bug description",
14+
"state": "open",
15+
"locked": false,
16+
"assignee": null,
17+
"assignees": [
18+
19+
],
20+
"milestone": {
21+
"url": "https://api.github.com/repos/webcompat/webcompat-tests/milestones/3",
22+
"html_url": "https://github.com/webcompat/webcompat-tests/milestone/3",
23+
"labels_url": "https://api.github.com/repos/webcompat/webcompat-tests/milestones/3/labels",
24+
"id": 2744176,
25+
"node_id": "MDk6TWlsZXN0b25lMjc0NDE3Ng==",
26+
"number": 3,
27+
"title": "needscontact",
28+
"description": "We are looking for an appropriate contact",
29+
"open_issues": 62,
30+
"closed_issues": 3,
31+
"state": "open",
32+
"created_at": "2017-09-05T03:40:35Z",
33+
"updated_at": "2020-11-07T03:21:44Z",
34+
"due_on": null,
35+
"closed_at": null
36+
},
37+
"comments": 0,
38+
"created_at": "2020-11-04T01:41:16Z",
39+
"updated_at": "2020-11-07T03:21:44Z",
40+
"closed_at": null,
41+
"author_association": "NONE",
42+
"active_lock_reason": null,
43+
"body": "<!-- @browser: Firefox 87.0 -->\n<!-- @ua_header: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:87.0) Gecko/20100101 Firefox/87.0 -->\n<!-- @reported_with: unknown -->\n\n**URL**: https://www.optimum.net/\n\n**Browser / Version**: Firefox 87.0\n**Operating System**: Mac OS X 10.14\n**Tested Another Browser**: Yes Chrome\n\n**Problem type**: Desktop site instead of mobile site\n**Description**: Desktop site instead of mobile site\n**Steps to Reproduce**:\nertytrw345rty v2345ty45rty 4rtytet5\n\n<details>\n<summary>Browser Configuration</summary>\n<ul>\n <li>None</li>\n</ul>\n</details>\n\n_From [webcompat.com](https://webcompat.com/) with ❤️_", "performed_via_github_app": null
44+
},
45+
"milestone": {
46+
"title": "needscontact"
47+
}
48+
}

tests/unit/test_webhook_model.py

+10
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ def test_prepare_outreach_comment():
190190
expected_payload).get('body')
191191

192192

193+
def test_prepare_outreach_comment_for_auth_report():
194+
"""Test we prepare the right comment body."""
195+
expected_payload = '{"body": "[Generate outreach template](https://webcompat.com/outreach/2598)"}' # noqa
196+
json_event, signature = event_data('public_milestone_needscontact_auth_report.json') # noqa
197+
payload = json.loads(json_event)
198+
issue = WebHookIssue.from_dict(payload, "https://webcompat.com/")
199+
assert issue.prepare_outreach_comment() == json.loads(
200+
expected_payload).get('body')
201+
202+
193203
def test_get_public_issue_number():
194204
"""Test the extraction of the issue number from the public_url."""
195205
json_event, signature = event_data('private_issue_opened.json')

webcompat/webhooks/model.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,11 @@ def prepare_public_comment(self):
174174

175175
def prepare_outreach_comment(self):
176176
"""Build the comment with a link to the outreach generator page."""
177-
# public issue data
178-
public_number = self.get_public_issue_number()
179177
host = self.host_reported_from
180178
if not host:
181179
host = "https://webcompat.com/"
182180
# prepare the payload
183-
return f'[Generate outreach template]({host}outreach/{public_number})'
181+
return f'[Generate outreach template]({host}outreach/{self.number})'
184182

185183
def close_public_issue(self, reason='rejected'):
186184
"""Close a public issue for the given reason.

0 commit comments

Comments
 (0)