diff --git a/scipost_django/comments/templates/comments/_comments_list.html b/scipost_django/comments/templates/comments/_comments_list.html index c449eaa8551e03c843f4750929758e72365e4774..dc35e2086d0ce8a0edd323932f6d9c0308717fc1 100644 --- a/scipost_django/comments/templates/comments/_comments_list.html +++ b/scipost_django/comments/templates/comments/_comments_list.html @@ -1,8 +1,30 @@ -{% if comments %} - <ul class="{{ css_class|default:'' }}"> - {% for comment in comments %} - <li><a href="{{ comment.get_absolute_url }}"{% if target_blank %} target="_blank"{% endif %}>{% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} by {{ comment.get_author_str }} on {{ comment.date_submitted|date:'DATE_FORMAT' }}</a></li> - {% include 'comments/_comments_list.html' with comments=comment.nested_comments.vetted css_class='m-0 ps-4' %} - {% endfor %} - </ul> -{% endif %} +{% load submissions_extras %} + +{% with is_author=request.user|is_submission_author:sibling %} + + {% if comments or is_author and report %} + <ul class="{{ css_class|default:'' }}"> + {% for comment in comments %} + <li> + <a href="{{ comment.get_absolute_url }}"{% if target_blank %} target="_blank"{% endif %}> + {% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} + by {{ comment.get_author_str }} on {{ comment.date_submitted|date:'DATE_FORMAT' }} + </a> + </li> + + {% include 'comments/_comments_list.html' with comments=comment.nested_comments.vetted css_class='m-0 ps-4' %} + {% endfor %} + + <!-- Show reply action for authors next to unanswered reports --> + {% if is_author and report and not report.comments.author_replies.exists %} + <li> + <a href="{% url 'comments:reply_to_report' report_id=report.id %}"> + <span class="me-2">{% include "bi/pencil-square.html" %}</span>Reply to this referee report + </a> + </li> + {% endif %} + + </ul> + {% endif %} + +{% endwith %} \ No newline at end of file diff --git a/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html b/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html index 5a5ab6bbd374518d85404b7412e461f38d166b85..695725ed39b4c0af1f6c0251593d755686456d8d 100644 --- a/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html +++ b/scipost_django/submissions/templates/submissions/_submission_refereeing_history_entry.html @@ -1,8 +1,20 @@ {% if sibling.preprint.identifier_w_vn_nr in request.path %} <p class="text-center bg-info"><em>You are viewing this version</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 class="d-flex flex-column mt-3 mb-1"> + <div class="d-flex justify-content-between align-items-center pubtitleli fs-5 pe-1 ps-3"> + <a href="{{ sibling.get_absolute_url }}" {% if target_blank %} target="_blank"{% endif %}>{{ sibling.preprint.identifier_w_vn_nr }}</a> + + {% if submission.editor_in_charge == request.user.contributor or perms.scipost.can_oversee_refereeing and not is_author and not is_author_unchecked %} + <div class="d-flex gap-1"> + <a href="{% url 'submissions:submission' sibling.preprint.identifier_w_vn_nr %}" class="px-2 py-1 bg-primary text-white" + data-bs-toggle="tooltip" title="Submission Page"> {% include "bi/journal-text.html" %}</a> + <a href="{% url 'submissions:editorial_page' sibling.preprint.identifier_w_vn_nr %}" class="px-2 py-1 bg-warning text-white" + data-bs-toggle="tooltip" title="Editorial Page"> {% include "bi/pen-nib-fill.html" %}</a> + </div> + {% endif %} + </div> + <span class="text-muted mx-3">{% if sibling.is_resubmission_of %}Resubmission{% else %}Original submission{% endif %} on {{ sibling.submission_date|date:'Y-m-d' }}</span> </div> <ul class="my-2 ps-4"> {% for report in sibling.reports.accepted %} diff --git a/scipost_django/submissions/templatetags/submissions_extras.py b/scipost_django/submissions/templatetags/submissions_extras.py index bf52b52db47cc09ace08c6bdc8c52ce7f24a86d3..7409dcefd1c17d0f03652705f1915e2e467cf8c7 100644 --- a/scipost_django/submissions/templatetags/submissions_extras.py +++ b/scipost_django/submissions/templatetags/submissions_extras.py @@ -44,6 +44,10 @@ def is_possible_author_of_submission(user, submission): # User explicitly assigned author. return True + if submission.author_profiles.filter(profile=user.contributor.profile).exists(): + # Profile associated with the Submission during preassignment. + return True + if submission.authors_false_claims.filter(user=user).exists(): # User explicitly dissociated from the Submission. return False @@ -52,6 +56,18 @@ def is_possible_author_of_submission(user, submission): return user.last_name in submission.author_list +@register.filter +def is_submission_author(user, submission): + if not user.is_authenticated: + return False + + verified_author = submission.authors.filter(user=user).exists() + preassigned_author = submission.author_profiles.filter( + profile=user.contributor.profile + ).exists() + return verified_author or preassigned_author + + @register.filter def is_viewable_by_authors(recommendation): """Check if the EICRecommendation is viewable by the authors of the Submission."""