diff --git a/feedback/forms.py b/feedback/forms.py index 68f6d28..c8785a6 100644 --- a/feedback/forms.py +++ b/feedback/forms.py @@ -135,7 +135,12 @@ def get_notify(self): old_msg = "".join(old_msg.split()) new_msg = self.cleaned_data['response_msg'] or '' new_msg = "".join(new_msg.split()) - return Feedback.NOTIFY.NORMAL if old_msg != new_msg else Feedback.NOTIFY.NO + if new_msg == '': # empty message always removes notification + return Feedback.NOTIFY.REMOVE + elif old_msg == '' and new_msg != '': # empty to non-empty sends notification + return Feedback.NOTIFY.NORMAL + else: + return Feedback.NOTIFY.NO # editing non-empty message does not change notification status # FIXME: add support for instance.NOTIFY.IMPORTANT def save(self): # pylint: disable=arguments-differ diff --git a/feedback/models.py b/feedback/models.py index 70ff0e1..d45704a 100644 --- a/feedback/models.py +++ b/feedback/models.py @@ -407,8 +407,10 @@ class Meta: ('NO', 0, _('No notification')), ('NORMAL', 1, _('Normal notification')), ('IMPORTANT', 2, _('Important notification')), + ('REMOVE', 10, _('Remove notification')), ) NOTIFY_APLUS = { + NOTIFY.REMOVE: 'remove', NOTIFY.NORMAL: 'normal', NOTIFY.IMPORTANT: 'important', }