From 49bddbb85e73f89c9f4ad258d2bacd82421a58c8 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Mon, 16 Oct 2017 09:38:38 +0200 Subject: [PATCH] Make comment instructions clearer: identity revealed --- comments/templates/comments/_add_comment_form.html | 2 +- comments/templates/comments/new_comment.html | 2 +- submissions/templates/submissions/submission_detail.html | 4 ++-- submissions/templatetags/submissions_extras.py | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/comments/templates/comments/_add_comment_form.html b/comments/templates/comments/_add_comment_form.html index ac4a6b8c1..3a02aca52 100644 --- a/comments/templates/comments/_add_comment_form.html +++ b/comments/templates/comments/_add_comment_form.html @@ -53,7 +53,7 @@ <div class="row"> <div class="col-12"> <input type="submit" name="submit" value="Submit your Comment for vetting" class="btn btn-primary" id="submit-id-submit"> - <p class="mt-2" id="goodCommenter"><i>By clicking on Submit, you agree with the <a target="_blank" href="{% url 'scipost:terms_and_conditions' %}">Terms and Conditions</a>.</i></p> + <p class="mt-2" id="goodCommenter"><i>By clicking on Submit, you agree with the <a target="_blank" href="{% url 'scipost:terms_and_conditions' %}">Terms and Conditions</a>, in particular that <span class="text-danger">your identity will be attached to the Comment</span>.</i></p> </div> </div> </form> diff --git a/comments/templates/comments/new_comment.html b/comments/templates/comments/new_comment.html index 598652197..f0470b100 100644 --- a/comments/templates/comments/new_comment.html +++ b/comments/templates/comments/new_comment.html @@ -4,7 +4,7 @@ <hr> -<h2 class="highlight" id="contribute_comment">Contribute a Comment:</h2> +<h2 class="highlight" id="contribute_comment">Contribute a Comment: {% if user_is_referee and submission %} <small class="text-danger">you are an invited referee, please <a href="{% url 'submissions:submit_report' submission.arxiv_identifier_w_vn_nr %}">submit a Report</a> instead</small>{% endif %}</h2> {% url 'comments:new_comment' object_id=object_id type_of_object=type_of_object as url %} {% include 'comments/_add_comment_form.html' with form=form url=url %} diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 891f73799..552fefc9a 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -239,9 +239,9 @@ {# This is an apparent redundant logic block; however, it makes sure the "login to ..." links wouldn't be shown twice! #} {% if not user.is_authenticated and submission.comments.vetted.exists %} - {% include 'comments/new_comment.html' with object_id=submission.id type_of_object='submission' open_for_commenting=submission.open_for_commenting %} + {% include 'comments/new_comment.html' with object_id=submission.id type_of_object='submission' open_for_commenting=submission.open_for_commenting user_is_referee=submission|user_is_referee:request.user %} {% elif user.is_authenticated %} - {% include 'comments/new_comment.html' with object_id=submission.id type_of_object='submission' open_for_commenting=submission.open_for_commenting %} + {% include 'comments/new_comment.html' with object_id=submission.id type_of_object='submission' open_for_commenting=submission.open_for_commenting user_is_referee=submission|user_is_referee:request.user %} {% endif %} {% endblock content %} diff --git a/submissions/templatetags/submissions_extras.py b/submissions/templatetags/submissions_extras.py index de71caafb..0ec7944d1 100644 --- a/submissions/templatetags/submissions_extras.py +++ b/submissions/templatetags/submissions_extras.py @@ -23,3 +23,7 @@ def is_viewable_by_authors(recommendation): return recommendation.submission.status in ['revision_requested', 'resubmitted', 'accepted', 'rejected', 'published', 'withdrawn'] + +@register.filter +def user_is_referee(submission, user): + return submission.referee_invitations.filter(referee__user=user).exists() -- GitLab