def test_message_not_required_if_feedback_major_notification_user_watches_adds_comment(self):
     user_1 = N(User, id=1)
     decision = N(Decision, author=user_1, editor=user_1, id=1)
     
     self.assertFalse(
         additional_message_required(
             user_1, decision, FEEDBACK_MAJOR_CHANGES
         )
     )
 def test_message_required_if_user_not_already_observing(self):
     user_1 = N(User, id=1)
     decision = N(Decision, author=user_1, editor=user_1, id=1)
     
     self.assertTrue(
         additional_message_required(
             user_1, decision, FEEDBACK_MAJOR_CHANGES
         )
     )
 def test_message_required_if_major_changes_only_user_watches_adds_comment(self):
     user_1 = N(User, id=1)
     decision = N(Decision, author=user_1, editor=user_1, id=1)
     decision.watchers = []
     self.assertTrue(
         additional_message_required(
             user_1, decision, FEEDBACK_MAJOR_CHANGES
         )
     )
Exemple #4
0
    def save(self, commit=True):
        created = not self.instance.id
        decision = super(DecisionForm, self).save(commit)

        send_new_message = additional_message_required(
           decision.author or decision.editor,
           decision, MAIN_ITEMS_NOTIFICATIONS_ONLY)
        if commit and created:
            self.change_observers(decision, decision.author)
            if send_new_message:
                send_decision_notifications(decision, [decision.author])
        return decision
Exemple #5
0
    def save(self, commit=True):
        created = not self.instance.id
        decision = super(DecisionForm, self).save(commit)

        send_new_message = additional_message_required(
            decision.author or decision.editor, decision,
            MAIN_ITEMS_NOTIFICATIONS_ONLY)
        if commit and created:
            self.change_observers(decision, decision.author)
            if send_new_message:
                send_decision_notifications(decision, [decision.author])
        return decision