From 67b0ba7769b5fe0ede75d7e9ed049aafb49a4c82 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Thu, 23 Aug 2018 13:51:31 +0100 Subject: [PATCH] Ensure reviewers can access their own reviews --- .../funds/templates/funds/includes/review_table_row.html | 2 +- opentech/apply/review/blocks.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/opentech/apply/funds/templates/funds/includes/review_table_row.html b/opentech/apply/funds/templates/funds/includes/review_table_row.html index 18b05f47d..1717b7fe7 100644 --- a/opentech/apply/funds/templates/funds/includes/review_table_row.html +++ b/opentech/apply/funds/templates/funds/includes/review_table_row.html @@ -6,7 +6,7 @@ <td>-</td> {% else %} <td class="reviews-sidebar__author" colspan="2"> - {% if request.user.is_apply_staff %} + {% if request.user.is_apply_staff or request.user == review.author %} <a href="{% url 'apply:submissions:reviews:review' submission_pk=review.submission.id pk=review.id %}"> <span>{{ review.author }}</span> </a> diff --git a/opentech/apply/review/blocks.py b/opentech/apply/review/blocks.py index 275f1601f..6398ae8c1 100644 --- a/opentech/apply/review/blocks.py +++ b/opentech/apply/review/blocks.py @@ -22,7 +22,11 @@ class ScoreFieldBlock(OptionalFormFieldBlock): template = 'review/render_scored_answer_field.html' def render(self, value, context=None): - comment, score = context['data'] + try: + comment, score = context['data'] + except ValueError: + # TODO: Remove json load as data moved away from JSON + comment, score = json.loads(context['data']) context.update(**{ 'comment': comment, 'score': RATE_CHOICES_DICT.get(int(score), RATE_CHOICE_NA) -- GitLab