diff --git a/scipost_django/submissions/migrations/0151_report_publicly_visible.py b/scipost_django/submissions/migrations/0151_report_publicly_visible.py new file mode 100644 index 0000000000000000000000000000000000000000..c8d23b62fdaf10db999f6b40c78ba6ea51ca6c36 --- /dev/null +++ b/scipost_django/submissions/migrations/0151_report_publicly_visible.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.10 on 2024-04-09 10:55 + +from django.db import migrations, models + + +def set_existing_reports_publicly_invisible(apps, schema_editor): + Report = apps.get_model("submissions", "Report") + Report.objects.update(recommendation_publicly_visible=False) + + +class Migration(migrations.Migration): + dependencies = [ + ("submissions", "0150_submission_code_metadata"), + ] + + operations = [ + migrations.AddField( + model_name="report", + name="recommendation_publicly_visible", + field=models.BooleanField(default=True), + ), + migrations.RunPython( + set_existing_reports_publicly_invisible, + reverse_code=migrations.RunPython.noop, + ), + ] diff --git a/scipost_django/submissions/models/report.py b/scipost_django/submissions/models/report.py index 2eb7fc6b54e633b9ec8a39af7a3cdbe816300c5c..c532f16449b54f7695e35e8ff9e1292f1888ea19 100644 --- a/scipost_django/submissions/models/report.py +++ b/scipost_django/submissions/models/report.py @@ -110,6 +110,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): ) recommendation = models.SmallIntegerField(null=True, blank=True, choices=REPORT_REC) + recommendation_publicly_visible = models.BooleanField(default=True) remarks_for_editors = models.TextField( blank=True, verbose_name="optional remarks for the Editors only" ) diff --git a/scipost_django/submissions/templates/submissions/_report_content.html b/scipost_django/submissions/templates/submissions/_report_content.html index c6e23c38d75671b82ec6d8e6106780292439fea0..4e6a6371d2d117803caa80c999b7b553a812414b 100644 --- a/scipost_django/submissions/templates/submissions/_report_content.html +++ b/scipost_django/submissions/templates/submissions/_report_content.html @@ -38,8 +38,22 @@ <div class="row"> <div class="col-12"> <h3 class="highlight tight">Attachment</h3> - <div class="ps-md-4">{% include 'bi/download.html' %} <a href="{{ report.get_attachment_url }}">Download attachment</a></div> - <br> + <div class="ps-md-4"> + {% include 'bi/download.html' %} + <a href="{{ report.get_attachment_url }}">Download attachment</a> + </div> + <br /> + </div> + </div> +{% endif %} + +{% if report.recommendation_publicly_visible %} + <div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Recommendation</h3> + <div class="ps-md-4"> + <p>{{ report.get_recommendation_display }}</p> + </div> </div> </div> {% endif %} diff --git a/scipost_django/submissions/templates/submissions/_report_public_without_comments.html b/scipost_django/submissions/templates/submissions/_report_public_without_comments.html index a45984a7617797921e53914dc0450b7a2b29b623..8b5e65ad4d1643b5e37d97f6a48d23798c6aed0a 100644 --- a/scipost_django/submissions/templates/submissions/_report_public_without_comments.html +++ b/scipost_django/submissions/templates/submissions/_report_public_without_comments.html @@ -106,13 +106,6 @@ </div> {% endif %} - {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and not user|is_possible_author_of_submission:submission %} - <div class="m-2 p-2 border border-danger"> - <h3 class="highlight tight">Recommendation</h3> - <div class="ps-md-4">{{ report.get_recommendation_display }}</div> - </div> - {% endif %} - {% block single_report_footer %}{% endblock %} </div> </div>