From efbeec4d73c2456acbcb4ec459ce78c2851071ee Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Tue, 19 Feb 2019 11:16:37 +0000 Subject: [PATCH] Gh-858: make sure we handle batch transition in kwargs --- opentech/apply/activity/messaging.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py index 2d519f5fd..f0b775a42 100644 --- a/opentech/apply/activity/messaging.py +++ b/opentech/apply/activity/messaging.py @@ -200,11 +200,14 @@ class ActivityAdapter(AdapterBase): def recipients(self, message_type, **kwargs): return [None] - def extra_kwargs(self, message_type, submission, **kwargs): + def extra_kwargs(self, message_type, submission, submissions, **kwargs): from .models import INTERNAL if message_type in [MESSAGES.OPENED_SEALED, MESSAGES.REVIEWERS_UPDATED, MESSAGES.SCREENING]: return {'visibility': INTERNAL} - if message_type == MESSAGES.TRANSITION and not submission.phase.permissions.can_view(submission.user): + is_transition = message_type in [MESSAGES.TRANSITION, MESSAGES.BATCH_TRANSITION] + + submission = submission or submissions[0] + if is_transition and not submission.phase.permissions.can_view(submission.user): # User's shouldn't see status activity changes for stages that aren't visible to the them return {'visibility': INTERNAL} return {} -- GitLab