From c39d85bac98c3367736091611c46632ffd7a5f0f Mon Sep 17 00:00:00 2001 From: Wes Appler <145372368+wes-otf@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:31:51 -0400 Subject: [PATCH] Add `APPLICANT_PARTNER` visibility to staff comment visibility (#3832) Fixes #3831. Somehow this slipped through both me & user testing but all works well now. Also swapped so staff comment logic gets evaluated first, thus if staff submits an application (usually for testing) then goes to make a comment to another application they won't be stuck with applicant options for visibility. --- hypha/apply/activity/models.py | 41 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/hypha/apply/activity/models.py b/hypha/apply/activity/models.py index d0fe8c36b..016b3d311 100644 --- a/hypha/apply/activity/models.py +++ b/hypha/apply/activity/models.py @@ -224,7 +224,7 @@ class Activity(models.Model): A list of visibility strings """ if user.is_apply_staff: - return [TEAM, APPLICANT, REVIEWER, PARTNER, ALL] + return [TEAM, APPLICANT, REVIEWER, APPLICANT_PARTNERS, PARTNER, ALL] if user.is_reviewer: return [REVIEWER, ALL] if user.is_finance or user.is_contracting: @@ -259,25 +259,6 @@ class Activity(models.Model): """ has_partner = submission_partner_list and len(submission_partner_list) > 0 - if user.is_partner and has_partner and submission_partner_list.contains(user): - return [ - (APPLICANT_PARTNERS, VISIBILITY[APPLICANT_PARTNERS]), - (PARTNER, VISIBILITY[PARTNER]), - (TEAM, VISIBILITY[TEAM]), - ] - - if user.is_applicant and has_partner: - return [ - (APPLICANT_PARTNERS, VISIBILITY[PARTNER]), - (APPLICANT, VISIBILITY[TEAM]), - ] - - if user.is_applicant: - return [(APPLICANT, VISIBILITY[APPLICANT])] - - if user.is_reviewer: - return [(REVIEWER, VISIBILITY[REVIEWER])] - if user.is_apply_staff: if not has_partner: choices = [ @@ -295,9 +276,27 @@ class Activity(models.Model): (REVIEWER, VISIBILITY[REVIEWER]), (ALL, VISIBILITY[ALL]), ] - return choices + if user.is_partner and has_partner and submission_partner_list.contains(user): + return [ + (APPLICANT_PARTNERS, VISIBILITY[APPLICANT_PARTNERS]), + (PARTNER, VISIBILITY[PARTNER]), + (TEAM, VISIBILITY[TEAM]), + ] + + if user.is_applicant and has_partner: + return [ + (APPLICANT_PARTNERS, VISIBILITY[PARTNER]), + (APPLICANT, VISIBILITY[TEAM]), + ] + + if user.is_applicant: + return [(APPLICANT, VISIBILITY[APPLICANT])] + + if user.is_reviewer: + return [(REVIEWER, VISIBILITY[REVIEWER])] + if user.is_finance or user.is_contracting: return [(TEAM, VISIBILITY[TEAM]), (APPLICANT, VISIBILITY[APPLICANT])] -- GitLab