Expose escalation reason in reviewer tools (#21929)
This commit is contained in:
Родитель
4f5a49af1f
Коммит
ba5fdc81a4
|
@ -226,12 +226,15 @@ class CinderJobChoiceField(ModelMultipleChoiceField):
|
|||
)
|
||||
for report in reports
|
||||
)
|
||||
subtext = f'Reasoning: {obj.decision_notes}' if is_escalation else ''
|
||||
return format_html(
|
||||
'{}{}{}<details><summary>Show {} reports</summary><ul>{}</ul></details>',
|
||||
'{}{}{}<details><summary>Show detail on {} reports</summary>'
|
||||
'<span>{}</span><ul>{}</ul></details>',
|
||||
'[Appeal] ' if obj.is_appeal else '',
|
||||
'[Escalation] ' if is_escalation else '',
|
||||
format_html_join(', ', '"{}"', reasons_set),
|
||||
len(reports),
|
||||
subtext,
|
||||
format_html_join('', '<li>{}{}</li>', messages_gen),
|
||||
)
|
||||
|
||||
|
|
|
@ -829,6 +829,7 @@ class TestReviewForm(TestCase):
|
|||
cinder_job_escalated = CinderJob.objects.create(
|
||||
job_id='escalated',
|
||||
decision_action=CinderJob.DECISION_ACTIONS.AMO_ESCALATE_ADDON,
|
||||
decision_notes='Why o why',
|
||||
resolvable_in_reviewer_tools=True,
|
||||
target_addon=self.addon,
|
||||
)
|
||||
|
@ -891,15 +892,18 @@ class TestReviewForm(TestCase):
|
|||
content = str(form['resolve_cinder_jobs'])
|
||||
doc = pq(content)
|
||||
assert doc('label[for="id_resolve_cinder_jobs_0"]').text() == (
|
||||
'[Escalation] "DSA: It violates Mozilla\'s Add-on Policies"'
|
||||
'\nShow 1 reports\nv[<script>alert()</script>]: ddd'
|
||||
'[Escalation] "DSA: It violates Mozilla\'s Add-on Policies"\n'
|
||||
'Show detail on 1 reports\n'
|
||||
'Reasoning: Why o why\n'
|
||||
'v[<script>alert()</script>]: ddd'
|
||||
)
|
||||
assert '<script>alert()</script>' not in content # should be escaped
|
||||
assert '<script>alert()</script>' in content # should be escaped
|
||||
assert doc('label[for="id_resolve_cinder_jobs_1"]').text() == (
|
||||
'[Appeal] "DSA: It violates Mozilla\'s Add-on Policies"'
|
||||
'\nShow 1 reports\nv[1.2]: ccc'
|
||||
'\nShow detail on 1 reports\nv[1.2]: ccc'
|
||||
)
|
||||
assert doc('label[for="id_resolve_cinder_jobs_2"]').text() == (
|
||||
'"DSA: It violates Mozilla\'s Add-on Policies"\nShow 2 reports\naaa\nbbb'
|
||||
'"DSA: It violates Mozilla\'s Add-on Policies"\n'
|
||||
'Show detail on 2 reports\naaa\nbbb'
|
||||
)
|
||||
|
|
|
@ -5542,14 +5542,14 @@ class TestReview(ReviewBase):
|
|||
message='Its baaaad',
|
||||
)
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotContains(response, 'Show 1 reports')
|
||||
self.assertNotContains(response, 'Show detail on 1 reports')
|
||||
|
||||
with (
|
||||
override_switch('enable-cinder-reporting', active=True),
|
||||
override_switch('enable-cinder-reviewer-tools-integration', active=True),
|
||||
):
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(response, 'Show 1 reports')
|
||||
self.assertContains(response, 'Show detail on 1 reports')
|
||||
self.assertContains(response, 'Its baaaad')
|
||||
|
||||
@override_switch('enable-cinder-reporting', active=True)
|
||||
|
|
|
@ -1043,6 +1043,16 @@ form.review-form .data-toggle {
|
|||
list-style: none;
|
||||
}
|
||||
|
||||
.review-actions-section #id_resolve_cinder_jobs {
|
||||
details {
|
||||
margin-left: 2em;
|
||||
}
|
||||
span {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.review-delayed-rejection-inner {
|
||||
display: inline-grid;
|
||||
grid-template-areas:
|
||||
|
|
Загрузка…
Ссылка в новой задаче