Skip to content

Commit fc69f7b

Browse files
murhum1ihalaij1
authored andcommitted
Change how service requests A+ to show notifications
Changed the behavior of sending notifications to students when editing feedback messages.
1 parent 5fe3d5f commit fc69f7b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

feedback/forms.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ def get_notify(self):
135135
old_msg = "".join(old_msg.split())
136136
new_msg = self.cleaned_data['response_msg'] or ''
137137
new_msg = "".join(new_msg.split())
138-
return Feedback.NOTIFY.NORMAL if old_msg != new_msg else Feedback.NOTIFY.NO
138+
if new_msg == '': # empty message always removes notification
139+
return Feedback.NOTIFY.REMOVE
140+
elif old_msg == '' and new_msg != '': # empty to non-empty sends notification
141+
return Feedback.NOTIFY.NORMAL
142+
else:
143+
return Feedback.NOTIFY.NO # editing non-empty message does not change notification status
139144
# FIXME: add support for instance.NOTIFY.IMPORTANT
140145

141146
def save(self): # pylint: disable=arguments-differ

feedback/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,10 @@ class Meta:
407407
('NO', 0, _('No notification')),
408408
('NORMAL', 1, _('Normal notification')),
409409
('IMPORTANT', 2, _('Important notification')),
410+
('REMOVE', 10, _('Remove notification')),
410411
)
411412
NOTIFY_APLUS = {
413+
NOTIFY.REMOVE: 'remove',
412414
NOTIFY.NORMAL: 'normal',
413415
NOTIFY.IMPORTANT: 'important',
414416
}

0 commit comments

Comments
 (0)