Skip to content

Commit fe77bc3

Browse files
author
Karl Dubost
authored
Merge pull request #3156 from webcompat/issue/3150/1
Fixes #3150 - Send the "moderation in process" message to the public issue
2 parents 6cbb596 + 52a2e8d commit fe77bc3

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

tests/unit/test_issues.py

+11
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99

1010
import unittest
1111
import requests
12+
import json
1213

1314
from mock import patch
15+
from mock import ANY
1416
from werkzeug import MultiDict
1517

1618
from webcompat.issues import report_issue
1719
from webcompat.issues import report_private_issue
20+
from webcompat.issues import report_public_issue
21+
from webcompat.issues import moderation_template
1822

1923

2024
class TestIssue(unittest.TestCase):
@@ -60,3 +64,10 @@ def test_report_private_issue_returns_nothing(self, mockpost):
6064
('username', ''), ])
6165
rv = report_private_issue(form, 'http://public.example.com')
6266
self.assertIsNone(rv)
67+
68+
@patch.object(requests, 'post')
69+
def test_report_public_issue_returns_moderation_template(self, mockpost):
70+
"""Test that we get a moderation template back from a public issue report.""" # noqa
71+
report_public_issue()
72+
data = json.dumps(moderation_template())
73+
mockpost.assert_called_with(ANY, data=data, headers=ANY, params=ANY)

webcompat/issues.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@
2424
PRIVATE_REPO_MILESTONE = app.config['PRIVATE_REPO_MILESTONE']
2525

2626

27-
def unmoderated_issue():
27+
def moderation_template():
2828
"""Gets the placeholder data to send for unmoderated issues."""
29-
# TODO: Replace this with something meaningful.
30-
# See https://github.com/webcompat/webcompat.com/issues/3137
31-
summary = 'Placeholder in-moderation title.'
32-
body = 'Placeholder in-moderation body.'
29+
30+
summary = 'In the moderation queue.'
31+
body = '''<p>This issue has been put in the moderation queue. A human
32+
will review if the message meets our current
33+
<a href="https://www.mozilla.org/en-US/about/legal/acceptable-use/">
34+
acceptable use</a> guidelines.
35+
It will probably take a couple of days depending on the backlog.
36+
Once it has been reviewed, the content will be either made public
37+
or deleted.</p>'''
3338
return {'title': summary, 'body': body}
3439

3540

@@ -51,13 +56,13 @@ def report_private_issue(form, public_url):
5156
return None
5257

5358

54-
def report_public_issue(form):
59+
def report_public_issue():
5560
"""Report the issue publicly.
5661
5762
Returns a requests.Response object.
5863
"""
5964
path = 'repos/{0}'.format(REPO_URI)
60-
return proxy_request('post', path, data=json.dumps(unmoderated_issue()))
65+
return proxy_request('post', path, data=json.dumps(moderation_template()))
6166

6267

6368
def report_issue(form, proxy=False):
@@ -66,7 +71,7 @@ def report_issue(form, proxy=False):
6671
path = 'repos/{0}'.format(REPO_URI)
6772
submit_type = form.get('submit_type')
6873
if proxy and submit_type == 'github-proxy-report':
69-
response = report_public_issue(form)
74+
response = report_public_issue()
7075
if (response.status_code == 201):
7176
json_response = response.json()
7277
report_private_issue(form, json_response.get('html_url'))

webcompat/static/css/src/issue.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
}
126126

127127
.issue-details {
128-
word-break: break-all;
128+
word-break: break-word;
129129
}
130130

131131
.issue-details-nsfw {

0 commit comments

Comments
 (0)