diff --git a/scipost_django/SciPost_v1/signalprocessors.py b/scipost_django/SciPost_v1/signalprocessors.py index c14da3b739f385947dfb1a457ea502239e3a23a4..085b68cc7d75899d70ef9d808befa9a9d0cccb3c 100644 --- a/scipost_django/SciPost_v1/signalprocessors.py +++ b/scipost_django/SciPost_v1/signalprocessors.py @@ -22,7 +22,7 @@ def remove_objects_indexes(sender_type_id, object_type_id, object_id): if isinstance(instance, Submission): # Submission have complex status handling, so a status change should lead to # more drastic reindexing. - ids_list = [k['id'] for k in list(instance.thread.public().values('id'))] + ids_list = [k['id'] for k in list(instance.thread.values('id'))] objects = Submission.objects.filter(pk__in=ids_list) else: # Objects such as Reports, Comments, Commentaries, etc. may get rejected. This diff --git a/scipost_django/submissions/models/submission.py b/scipost_django/submissions/models/submission.py index 7380b43f7681f204eb05f41cbd66843a4c350d68..500831985b3e3f36dc4bf9bb2664c4ae810bd18c 100644 --- a/scipost_django/submissions/models/submission.py +++ b/scipost_django/submissions/models/submission.py @@ -336,6 +336,12 @@ class Submission(models.Model): return self.editor_in_charge is not None + @property + def thread_full(self): + """Return all Submissions in the database in this thread.""" + return Submission.objects.filter(thread_hash=self.thread_hash).order_by( + '-submission_date', '-preprint') + @property def thread(self): """Return all (public) Submissions in the database in this thread.""" diff --git a/scipost_django/submissions/templates/submissions/_submission_refereeing_history.html b/scipost_django/submissions/templates/submissions/_submission_refereeing_history.html index ed2ea876148433c7851734f86760582e9f5bbc1a..53ca47102e863a606339785c34afcc8fdd81c06b 100644 --- a/scipost_django/submissions/templates/submissions/_submission_refereeing_history.html +++ b/scipost_django/submissions/templates/submissions/_submission_refereeing_history.html @@ -1,29 +1,29 @@ +{% load submissions_extras %} {% load request_filters %} <div class="submission-contents"> <h3>Submission & Refereeing History</h3> {% if perms.scipost.can_oversee_refereeing %} <small class="text-muted">Thread {{ submission.thread_hash }} - <br/>(all emails concerning this stream contain this uuid)</small> + <br/>(all emails concerning this stream contain this uuid)</small> {% endif %} - {% for sibling in submission.thread.public %} - <div class="p-2{% if sibling.preprint.identifier_w_vn_nr in request.path %} border border-secondary{% endif %}"> - {% if sibling.preprint.identifier_w_vn_nr in request.path %} - <p class="text-center bg-info"><em>You are currently on this page</em></p> - {% endif %} - <div class="mt-3 mb-1"> - {% if sibling.is_resubmission_of %}Resubmission{% else %}Submission{% endif %} <a href="{{ sibling.get_absolute_url }}" class="pubtitleli"{% if target_blank %} target="_blank"{% endif %}>{{ sibling.preprint.identifier_w_vn_nr }}</a> on {{ sibling.submission_date|date:'j F Y' }} + {% if perms.scipost.can_oversee_refereeing or request.user|is_in_submission_fellowship:submission %} + {% for sibling in submission.thread_full %} + <div class="p-2{% if sibling.preprint.identifier_w_vn_nr in request.path %} border border-secondary{% endif %}"> + {% include 'submissions/_submission_refereeing_history_entry.html' with sibling=sibling %} + {% include 'comments/_comments_list.html' with comments=sibling.comments.vetted css_class='my-2 ps-4' target_blank=target_blank %} </div> - <ul class="my-2 ps-4"> - {% for report in sibling.reports.accepted %} - <li><a href="{{ report.get_absolute_url }}"{% if target_blank %} target="_blank"{% endif %}>Report {{ report.report_nr }} submitted on {{ report.date_submitted }} by {% if report.anonymous %}<em>Anonymous</em>{% else %}{{ report.author.profile.get_title_display }} {{ report.author.user.last_name }}{% endif %}</a></li> - {% include 'comments/_comments_list.html' with comments=report.comments.vetted css_class='my-1 ps-4' target_blank=target_blank %} - {% endfor %} - </ul> - </div> - - {% include 'comments/_comments_list.html' with comments=sibling.comments.vetted css_class='my-2 ps-4' target_blank=target_blank %} - {% empty %} - <em>There are no publicly visible links available yet.</em> - {% endfor %} + {% empty %} + <em>There are no visible links available yet.</em> + {% endfor %} + {% else %} + {% for sibling in submission.thread %} + <div class="p-2{% if sibling.preprint.identifier_w_vn_nr in request.path %} border border-secondary{% endif %}"> + {% include 'submissions/_submission_refereeing_history_entry.html' with sibling=sibling %} + {% include 'comments/_comments_list.html' with comments=sibling.comments.vetted css_class='my-2 ps-4' target_blank=target_blank %} + </div> + {% empty %} + <em>There are no publicly visible links available yet.</em> + {% endfor %} + {% endif %} </div> diff --git a/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html b/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html new file mode 100644 index 0000000000000000000000000000000000000000..8917b787920cfa45f899385216b28fc6089a7d92 --- /dev/null +++ b/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html @@ -0,0 +1,12 @@ +{% if sibling.preprint.identifier_w_vn_nr in request.path %} + <p class="text-center bg-info"><em>You are currently on this page</em></p> +{% endif %} +<div class="mt-3 mb-1"> + {% if sibling.is_resubmission_of %}Resubmission{% else %}Submission{% endif %} <a href="{{ sibling.get_absolute_url }}" class="pubtitleli"{% if target_blank %} target="_blank"{% endif %}>{{ sibling.preprint.identifier_w_vn_nr }}</a> on {{ sibling.submission_date|date:'j F Y' }} +</div> +<ul class="my-2 ps-4"> + {% for report in sibling.reports.accepted %} + <li><a href="{{ report.get_absolute_url }}"{% if target_blank %} target="_blank"{% endif %}>Report {{ report.report_nr }} submitted on {{ report.date_submitted }} by {% if report.anonymous %}<em>Anonymous</em>{% else %}{{ report.author.profile.get_title_display }} {{ report.author.user.last_name }}{% endif %}</a></li> + {% include 'comments/_comments_list.html' with comments=report.comments.vetted css_class='my-1 ps-4' target_blank=target_blank %} + {% endfor %} +</ul> diff --git a/scipost_django/submissions/templatetags/submissions_extras.py b/scipost_django/submissions/templatetags/submissions_extras.py index 5374faf7571146459f0d97cc81fac3caf215c416..d58fcd0fe901e1cbdb957c0401119ead172d0ccb 100644 --- a/scipost_django/submissions/templatetags/submissions_extras.py +++ b/scipost_django/submissions/templatetags/submissions_extras.py @@ -16,6 +16,11 @@ def filter_for_submission(qs, submission): return qs.filter(submission=submission) +@register.filter +def is_in_submission_fellowship(user, submission): + return submission.fellows.filter(contributor__user=user).exists() + + @register.filter def is_possible_author_of_submission(user, submission): """Check if User may be related to the Submission as author."""