From 3f12bbc8ed74c99199e257b5db8609c51f7eb8dc Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Mon, 23 Jul 2018 16:05:49 +0100 Subject: [PATCH] Add new review messages --- opentech/apply/activity/messaging.py | 2 ++ opentech/apply/review/models.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py index 6c5ab6f09..08b612047 100644 --- a/opentech/apply/activity/messaging.py +++ b/opentech/apply/activity/messaging.py @@ -12,6 +12,7 @@ class MESSAGES(Enum): DETERMINATION_OUTCOME = 'determination_outcome' INVITED_TO_PROPOSAL = 'invited_to_proposal' REVIEWERS_UPDATED = 'reviewers_updated' + NEW_REVIEW = 'new_review' COMMENT = 'comment' @@ -29,6 +30,7 @@ class ActivityAdapter: MESSAGES.DETERMINATION_OUTCOME: 'Sent a {submission.determination.get_outcome_display} determination for {submission.title}:\r\n{determination.clean_message}', MESSAGES.INVITED_TO_PROPOSAL: '{submission.title} has been invited to submit a proposal.', MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated', + MESSAGES.NEW_REVIEW: 'Created a review for {submission.title}' } def message(self, message_type, **kwargs): diff --git a/opentech/apply/review/models.py b/opentech/apply/review/models.py index 1247fbeed..912cafa18 100644 --- a/opentech/apply/review/models.py +++ b/opentech/apply/review/models.py @@ -5,9 +5,10 @@ from django.db.models.signals import post_save from django.dispatch import receiver from django.urls import reverse -from opentech.apply.activity.models import Activity +from opentech.apply.activity.messaging import messenger, MESSAGES from opentech.apply.users.models import User + NO = 0 MAYBE = 1 YES = 2 @@ -92,8 +93,8 @@ def update_submission_reviewers_list(sender, **kwargs): review.submission.reviewers.add(review.author) if kwargs.get('created', False): - Activity.actions.create( + messenger( + MESSAGES.NEW_REVIEW, user=review.author, submission=review.submission, - message=f'Created a review for {review.submission.title}' ) -- GitLab