-
-
Notifications
You must be signed in to change notification settings - Fork 58
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
The notification verb is saved in the database. Thus, changing the verb in the NOTIFICATION_TYPE does not change the message of existing notifications.
Steps To Reproduce
Steps to reproduce the behavior:
- Create a default notification using the
create_notificationmanagement command. - Go to Django admin and verify the notification message.
Default notification with default verb and level info by default
- Change the verb for the default notification type
openwisp-notifications/openwisp_notifications/types.py
Lines 7 to 19 in 55a3443
'default': { 'level': 'info', 'verb': 'default verb', 'verbose_name': 'Default Type', 'email_subject': '[{site.name}] Default Notification Subject', 'message': ( 'Default notification with {notification.verb} and level {notification.level}' ' by [{notification.target}]({notification.target_link})' ), 'message_template': 'openwisp_notifications/default_message.md', 'email_notification': True, 'web_notification': True, }, - Go to Django admin again and verify the notification message
Expected behavior
The notification message should show the updated notification verb
Possible solution
Update the notify handler to not save the verb in the database.
openwisp-notifications/openwisp_notifications/handlers.py
Lines 139 to 148 in 55a3443
| notification = Notification( | |
| recipient=recipient, | |
| actor=actor, | |
| verb=str(verb), | |
| public=public, | |
| description=description, | |
| timestamp=timestamp, | |
| level=level, | |
| type=notification_type, | |
| ) |
Update the AbstractNotification model to use the verb from the configuration if database value is set to None
nemesifier
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Type
Projects
Status
To do
Status
To do (Python & Django)