Skip to content

Commit e10a56e

Browse files
authored
Merge pull request #1138 from alphagov/2128-rm-feedback
2128: Remove report issue UI
2 parents 717a451 + f4eed7c commit e10a56e

16 files changed

Lines changed: 5 additions & 500 deletions

File tree

accessibility_monitoring_platform/apps/common/forms.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -415,26 +415,6 @@ class PlatformCheckingForm(forms.Form):
415415
message = AMPCharFieldWide(label="Message", initial="Test log message")
416416

417417

418-
class AMPIssueReportForm(forms.ModelForm):
419-
"""
420-
Form used to record issue reported by user in database.
421-
"""
422-
423-
page_url = forms.CharField(widget=forms.HiddenInput())
424-
page_title = AMPCharFieldWide(label="Page where the problem occurred")
425-
goal_description = AMPTextField(label="What were you doing?")
426-
issue_description = AMPTextField(label="What went wrong?")
427-
428-
class Meta:
429-
model = IssueReport
430-
fields = [
431-
"page_url",
432-
"page_title",
433-
"goal_description",
434-
"issue_description",
435-
]
436-
437-
438418
class AMPTopMenuForm(forms.Form):
439419
"""
440420
Form for searching for cases in the top menu bar

accessibility_monitoring_platform/apps/common/sitemap.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,6 @@ def __init__(self, type=PlatformPageGroup.Type.MOBILE_CASE_NAV, **kwargs):
18471847
DetailedCasePlatformPage(
18481848
name="Detailed case history", url_name="detailed:case-history"
18491849
),
1850-
PlatformPage(name="Issue reports", url_name="tech:issue-reports-list"),
18511850
PlatformPage(
18521851
name="Reference implementation",
18531852
url_name="tech:reference-implementation",
@@ -1897,7 +1896,6 @@ def __init__(self, type=PlatformPageGroup.Type.MOBILE_CASE_NAV, **kwargs):
18971896
name="Accessibility statement",
18981897
url_name="common:accessibility-statement",
18991898
),
1900-
PlatformPage(name="Report an issue", url_name="common:issue-report"),
19011899
PlatformPage(name="Contact admin", url_name="common:contact-admin"),
19021900
PlatformPage(name="Dashboard", url_name="dashboard:home"),
19031901
PlatformPage(name="Tasks", url_name="notifications:task-list"),

accessibility_monitoring_platform/apps/common/templates/common/issue_report.html

Lines changed: 0 additions & 63 deletions
This file was deleted.

accessibility_monitoring_platform/apps/common/tests/test_urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Test urls of common app
33
"""
4+
45
import pytest
56
from django.http.response import HttpResponse
67
from django.urls import reverse
@@ -12,7 +13,6 @@
1213
"common:contact-admin",
1314
"common:edit-active-qa-auditor",
1415
"common:platform-history",
15-
"common:issue-report",
1616
"common:markdown-cheatsheet",
1717
],
1818
)

accessibility_monitoring_platform/apps/common/tests/test_views.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
FOUND_DOMAIN: str = "found"
3535
EMAIL_SUBJECT: str = "Email subject"
3636
EMAIL_MESSAGE: str = "Email message"
37-
ISSUE_REPORT_LINK: str = """<a class="govuk-footer__link" href="/common/report-issue/?page_url=/&page_title=Dashboard"
38-
target="_blank">Report an issue</a>"""
3937
METRIC_OVER_LAST_30_DAYS: str = """<p id="{metric_id}" class="govuk-body-m">
4038
<span class="govuk-!-font-size-48"><b>{number_last_30_days}</b></span>
4139
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -165,7 +163,6 @@
165163
("common:contact-admin", "Contact admin"),
166164
("common:edit-active-qa-auditor", ">Active QA auditor</h1>"),
167165
("common:platform-history", ">Platform version history</h1>"),
168-
("common:issue-report", ">Report an issue</h1>"),
169166
("common:accessibility-statement", ">Accessibility statement</h1>"),
170167
("common:privacy-notice", ">Privacy notice</h1>"),
171168
("common:markdown-cheatsheet", ">Markdown cheatsheet</h1>"),
@@ -278,29 +275,6 @@ def test_view_privacy_notice(client):
278275
)
279276

280277

281-
@pytest.mark.parametrize(
282-
"prototype_name,issue_report_link_expected",
283-
[
284-
("", True),
285-
("TEST", True),
286-
("anything-else", False),
287-
],
288-
)
289-
def test_issue_report_link(prototype_name, issue_report_link_expected, admin_client):
290-
"""
291-
Test issue report link is rendered on live and test platforms
292-
but not on prototypes.
293-
"""
294-
settings.AMP_PROTOTYPE_NAME = prototype_name
295-
response: HttpResponse = admin_client.get(reverse("dashboard:home"))
296-
297-
assert response.status_code == 200
298-
if issue_report_link_expected:
299-
assertContains(response, ISSUE_REPORT_LINK, html=True)
300-
else:
301-
assertNotContains(response, ISSUE_REPORT_LINK, html=True)
302-
303-
304278
@pytest.mark.parametrize(
305279
"case_field, metric_id, lowercase_label",
306280
[
@@ -1399,30 +1373,3 @@ def test_navbar_tasks_emboldened(admin_client, admin_user):
13991373
</li>""",
14001374
html=True,
14011375
)
1402-
1403-
1404-
@pytest.mark.parametrize(
1405-
"url, expected_page_name",
1406-
[
1407-
("/", "Your cases"),
1408-
("/cases/1/edit-case-metadata/", "Case metadata"),
1409-
("/audits/1/edit-audit-metadata/", "Initial test metadata"),
1410-
],
1411-
)
1412-
def test_page_name(url, expected_page_name, admin_client):
1413-
"""
1414-
Test that the page renders and problem page's url and name are populated
1415-
as expected.
1416-
"""
1417-
simplified_case: SimplifiedCase = SimplifiedCase.objects.create()
1418-
Audit.objects.create(simplified_case=simplified_case)
1419-
1420-
response: HttpResponse = admin_client.get(
1421-
f"/common/report-issue/?page_url={url}&page_title={expected_page_name}"
1422-
)
1423-
1424-
assert response.status_code == 200
1425-
1426-
assertContains(response, "Report an issue")
1427-
assertContains(response, url)
1428-
assertContains(response, expected_page_name)

accessibility_monitoring_platform/apps/common/urls.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
ContactAdminView,
1515
FooterLinkFormsetTemplateView,
1616
FrequentlyUsedLinkFormsetTemplateView,
17-
IssueReportView,
1817
MarkdownCheatsheetTemplateView,
1918
MetricsCaseTemplateView,
2019
MetricsPolicyTemplateView,
@@ -36,9 +35,6 @@
3635
login_required(ChangeToPlatformListView.as_view()),
3736
name="platform-history",
3837
),
39-
path(
40-
"report-issue/", login_required(IssueReportView.as_view()), name="issue-report"
41-
),
4238
path(
4339
"accessibility-statement/",
4440
AccessibilityStatementTemplateView.as_view(),

accessibility_monitoring_platform/apps/common/views.py

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
from django.contrib import messages
1010
from django.core.mail import EmailMessage
1111
from django.db.models.query import QuerySet
12-
from django.forms.models import ModelForm
1312
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
14-
from django.shortcuts import redirect
1513
from django.urls import reverse_lazy
1614
from django.views.generic import TemplateView
1715
from django.views.generic.edit import FormView, UpdateView
@@ -26,7 +24,6 @@
2624
from .forms import (
2725
ActiveQAAuditorUpdateForm,
2826
AMPContactAdminForm,
29-
AMPIssueReportForm,
3027
BulkURLSearchForm,
3128
FooterLinkFormset,
3229
FooterLinkOneExtraFormset,
@@ -44,13 +41,7 @@
4441
get_report_progress_metrics,
4542
get_report_yearly_metrics,
4643
)
47-
from .models import (
48-
ChangeToPlatform,
49-
FooterLink,
50-
FrequentlyUsedLink,
51-
IssueReport,
52-
Platform,
53-
)
44+
from .models import ChangeToPlatform, FooterLink, FrequentlyUsedLink, Platform
5445
from .platform_template_view import PlatformTemplateView
5546
from .utils import extract_domain_from_url, get_platform_settings, sanitise_domain
5647

@@ -135,63 +126,6 @@ def send_mail(self, cleaned_data: dict[str, str]) -> None:
135126
email.send()
136127

137128

138-
class IssueReportView(FormView):
139-
"""
140-
Save user feedback
141-
"""
142-
143-
form_class: type[AMPIssueReportForm] = AMPIssueReportForm
144-
template_name: str = "common/issue_report.html"
145-
success_url: str = reverse_lazy("dashboard:home")
146-
147-
def get(self, request, *args, **kwargs):
148-
"""Populate form"""
149-
target_page_url: str = self.request.GET.get("page_url", "")
150-
target_page_title: str = self.request.GET.get("page_title", "Unknown page")
151-
152-
goal_description: str = self.request.GET.get("goal_description", "")
153-
issue_description: str = self.request.GET.get("issue_description", "")
154-
self.form: AMPIssueReportForm = self.form_class(
155-
{
156-
"page_url": target_page_url,
157-
"page_title": target_page_title,
158-
"goal_description": goal_description,
159-
"issue_description": issue_description,
160-
}
161-
)
162-
self.form.is_valid()
163-
return super().get(request, *args, **kwargs)
164-
165-
def get_context_data(self, **kwargs) -> dict[str, Any]:
166-
"""Add field values into context"""
167-
context: dict[str, Any] = super().get_context_data(**kwargs)
168-
context["form"] = self.form
169-
return context
170-
171-
def form_valid(self, form: ModelForm):
172-
"""Process contents of valid form"""
173-
issue_report: IssueReport = form.save(commit=False)
174-
issue_report.created_by = self.request.user
175-
issue_report.save()
176-
self.send_mail(issue_report)
177-
return redirect(issue_report.page_url)
178-
179-
def send_mail(self, issue_report: IssueReport) -> None:
180-
email: EmailMessage = EmailMessage(
181-
subject=f"Platform issue on {issue_report.page_title}",
182-
body=f"""Reported by: {issue_report.created_by}
183-
184-
URL: https://{self.request.get_host()}{issue_report.page_url}
185-
186-
Goal: {issue_report.goal_description}
187-
188-
Issue: {issue_report.issue_description}""",
189-
from_email=self.request.user.email,
190-
to=[settings.CONTACT_ADMIN_EMAIL],
191-
)
192-
email.send()
193-
194-
195129
class ActiveQAAuditorUpdateView(UpdateView):
196130
"""
197131
Update active QA auditor

accessibility_monitoring_platform/apps/tech/forms.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,3 @@ class ImportTrelloCommentsForm(forms.Form):
4444
choices=Boolean.choices,
4545
widget=AMPChoiceCheckboxWidget(attrs={"label": "Delete existing data"}),
4646
)
47-
48-
49-
class IssueReportSearchForm(forms.Form):
50-
"""Form for searching for issue reports"""
51-
52-
issue_report_search = AMPCharFieldWide(
53-
widget=forms.TextInput(
54-
attrs={
55-
"class": "govuk-input",
56-
"placeholder": "Search term",
57-
}
58-
)
59-
)

0 commit comments

Comments
 (0)