Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion feedback/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions feedback/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down