diff --git a/CHANGELOG.md b/CHANGELOG.md index cb93af13..b35ef2ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ Types of changes: - `Fixed`: for any bug fixes. - `Security`: in case of vulnerabilities. +## [x.y.z] + +### Changed +- Issue report and resolve condensed to a single endpoint named `issue_handling`, functionality preserved. + ## [1.12.0] ### Added diff --git a/app/host/static/robots.txt b/app/host/static/robots.txt index afe0fb4d..6922ad92 100644 --- a/app/host/static/robots.txt +++ b/app/host/static/robots.txt @@ -6,8 +6,7 @@ Disallow: /download_modelfit/ Disallow: /download_percentiles/ Disallow: /retrigger_transient/ Disallow: /reprocess_transient/ -Disallow: /report_issue/ -Disallow: /resolve_issue/ +Disallow: /issue_handling/ Disallow: /healthz/ Disallow: /cutout_fits_plot/ Disallow: /fetch_sed_plot/ diff --git a/app/host/templates/host/processing_status_card.html b/app/host/templates/host/processing_status_card.html index 0d9fc52b..5019ee7c 100644 --- a/app/host/templates/host/processing_status_card.html +++ b/app/host/templates/host/processing_status_card.html @@ -37,7 +37,7 @@

Processing Status: { {% if item.user_warning %} Processing Status: { {% else %} """, - views.report_issue, - name="report_issue", - ), - path( - f"""{base_path}resolve_issue/""", - views.resolve_issue, - name="resolve_issue", + f"""{base_path}issue_handling//""", + views.issue_handling, + name="issue_handling", ), path(f"""{base_path}privacy""", views.privacy_policy, name='privacy'), path(f"""{base_path}healthz""", views.healthz, name='healthz'), diff --git a/app/host/views.py b/app/host/views.py index b052132e..8b65d4c9 100644 --- a/app/host/views.py +++ b/app/host/views.py @@ -741,29 +741,19 @@ def update_home_page_statistics(): with open(os.path.join(settings.STATIC_ROOT, 'index.html'), 'w') as fp: fp.write(html_body) - -@login_required -@log_usage_metric() -def report_issue(request, item_id): - item = TaskRegister.objects.get(pk=item_id) - item.user_warning = True - item.save() - return HttpResponseRedirect( - reverse_lazy("results", kwargs={"transient_name": item.transient.name}) - ) - - @login_required @log_usage_metric() -def resolve_issue(request, item_id): - item = TaskRegister.objects.get(pk=item_id) - item.user_warning = False +def issue_handling(request, item_id, action): + item = get_object_or_404(TaskRegister, pk=item_id) + if action == 'report': + item.user_warning = True + elif action == 'resolve': + item.user_warning = False item.save() return HttpResponseRedirect( reverse_lazy("results", kwargs={"transient_name": item.transient.name}) ) - # Handler for 403 errors def error_view(request, exception, template_name="403.html"): return render(request, template_name)