SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 22e0531e authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add edadmin anonymize button to reports

parent 50681a4d
No related branches found
No related tags found
No related merge requests found
{% load scipost_extras %}
{% load submissions_extras %}
<div class="row mb-5">
<div class="col-12">
<div class="report" id="report_{{ report.report_nr }}">
<div class="report" id="report_{{ report.report_nr }}">
<div class="row mb-5">
<div class="col-12">
<div class="reportid">
<h3>
{% if report.anonymous %}
......@@ -52,6 +52,12 @@
</div>
</div>
{% endif %}
{% else %}
{% if user|is_in_group:'Editorial Administrators' and not user|is_possible_author_of_submission:submission %}
<button class="btn btn-sm btn-danger text-white my-2" hx-get="{% url "submissions:_hx_anonymize_report" report_id=report.id %}" hx-target="#report_{{report.report_nr}}" hx-swap="outerHTML">
Anonymize this report
</button>
{% endif %}
{% endif %}
{% if report.doi_string or report.pdf_report %}
<ul class="clickables">
......
......@@ -226,9 +226,9 @@ urlpatterns = [
name="report_pdf_compile",
),
path(
"admin/reports/<int:report_id>/compile",
views.report_pdf_compile,
name="report_pdf_compile",
"admin/reports/<int:report_id>/_hx_anonymize_report",
views._hx_anonymize_report,
name="_hx_anonymize_report",
),
# Submission, resubmission, withdrawal
path( # Start a new submission process; choose resub or new sub (with field choice)
......
......@@ -99,6 +99,7 @@ from colleges.models import PotentialFellowship, Fellowship
from colleges.permissions import (
fellowship_required,
fellowship_or_admin_required,
is_edadmin,
is_edadmin_or_senior_fellow,
)
from comments.forms import CommentForm
......@@ -859,6 +860,25 @@ def report_pdf_compile(request, report_id):
return render(request, "submissions/admin/report_compile_form.html", context)
@login_required
@user_passes_test(is_edadmin)
def _hx_anonymize_report(request, report_id):
report = get_object_or_404(Report, id=report_id)
report.anonymous = True
report.save()
report.submission.add_event_for_eic(
f"{request.user.get_full_name()} anonymized "
f"referee report #{report.report_nr} "
f"(by {report.author.profile.full_name})"
)
return render(
request,
"submissions/_report_public.html",
{"report": report, "submission": report.submission},
)
@permission_required("scipost.can_manage_reports", raise_exception=True)
def treated_submissions_list(request):
"""List all treated Submissions.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment