diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py index 6c5ab6f09d77dc0a867613964e45b06dc9e85bd8..08b612047cf174e14737947a7e32534111af5f0a 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 1247fbeedfa20337c7c348cc40353abe30e9f0c3..912cafa180795a6dc2bee402ce99b220c4b4a588 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}' )