From f790dc8f131d0900eb9b94ba04d329c5b9267e00 Mon Sep 17 00:00:00 2001 From: gmurtaza00 <111306331+gmurtaza00@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:46:59 -0800 Subject: [PATCH] #3417: Configured default visibility for review (#3418) Configured setting for default visibility of review. It can be set as **private** or **reviewers**. - Private: Visible only to staff. - Reviewers: Visible to other reviewers and staff. **Setting to consider:** - ```REVIEW_VISIBILITY_DEFAULT ``` Closes #3417 --------- Co-authored-by: Fredrik Jonsson --- docs/setup/administrators/configuration.md | 8 ++++++++ hypha/apply/review/blocks.py | 4 ++-- hypha/settings/base.py | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/setup/administrators/configuration.md b/docs/setup/administrators/configuration.md index 0e13424a6c..bf9301b48d 100644 --- a/docs/setup/administrators/configuration.md +++ b/docs/setup/administrators/configuration.md @@ -160,6 +160,14 @@ Possible values are: fund, round, status, lead, reviewers, screening_statuses, c SUBMISSIONS_TABLE_EXCLUDED_FIELDS = env.list('SUBMISSIONS_TABLE_EXCLUDED_FIELDS', []) +### Default visibility for reviews. + +Possible values are: 'reviewers' or 'private'. +Private: Visible only to staff. +Reviewers: Visible to other reviewers and staff. + + REVIEW_VISIBILITY_DEFAULT = env.str('REVIEW_VISIBILITY_DEFAULT', 'private') + ### Should submission automatically transition after all reviewer roles are assigned. TRANSITION_AFTER_ASSIGNED = env.bool('TRANSITION_AFTER_ASSIGNED', False) diff --git a/hypha/apply/review/blocks.py b/hypha/apply/review/blocks.py index 988bdfc44b..2bc25ca696 100644 --- a/hypha/apply/review/blocks.py +++ b/hypha/apply/review/blocks.py @@ -1,6 +1,7 @@ import json from django import forms +from django.conf import settings from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from wagtail.blocks import RichTextBlock @@ -8,7 +9,6 @@ from hypha.apply.review.fields import ScoredAnswerField from hypha.apply.review.options import ( NA, - PRIVATE, RATE_CHOICE_NA, RATE_CHOICES, RATE_CHOICES_DICT, @@ -152,7 +152,7 @@ class Meta: def get_field_kwargs(self, struct_value): kwargs = super(VisibilityBlock, self).get_field_kwargs(struct_value) kwargs["choices"] = VISIBILITY.items() - kwargs["initial"] = PRIVATE + kwargs["initial"] = settings.REVIEW_VISIBILITY_DEFAULT kwargs["help_text"] = mark_safe( "
".join( [ diff --git a/hypha/settings/base.py b/hypha/settings/base.py index d8eabbd1c9..905c3d6dcd 100644 --- a/hypha/settings/base.py +++ b/hypha/settings/base.py @@ -144,6 +144,9 @@ # Possible values are: False, 1,2,3,… TRANSITION_AFTER_REVIEWS = env.bool("TRANSITION_AFTER_REVIEWS", False) +# Default visibility for reviews. +REVIEW_VISIBILITY_DEFAULT = env.str("REVIEW_VISIBILITY_DEFAULT", "private") + # Project settings.