Skip to content

Commit 80cc015

Browse files
committed
Issue #3150 - "Moderation in process" template
1 parent 588b1d1 commit 80cc015

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
@@ -23,12 +23,17 @@
2323
PRIVATE_REPO_URI = app.config['PRIVATE_REPO_URI']
2424

2525

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

3439

@@ -47,13 +52,13 @@ def report_private_issue(form, public_url):
4752
return None
4853

4954

50-
def report_public_issue(form):
55+
def report_public_issue():
5156
"""Report the issue publicly.
5257
5358
Returns a requests.Response object.
5459
"""
5560
path = 'repos/{0}'.format(REPO_URI)
56-
return proxy_request('post', path, data=json.dumps(unmoderated_issue()))
61+
return proxy_request('post', path, data=json.dumps(moderation_template()))
5762

5863

5964
def report_issue(form, proxy=False):
@@ -62,7 +67,7 @@ def report_issue(form, proxy=False):
6267
path = 'repos/{0}'.format(REPO_URI)
6368
submit_type = form.get('submit_type')
6469
if proxy and submit_type == 'github-proxy-report':
65-
response = report_public_issue(form)
70+
response = report_public_issue()
6671
if (response.status_code == 201):
6772
json_response = response.json()
6873
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)