-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Describe the bug
The populate_notification_preferences command does not delete the NotifiationSettings for undefined Notification Types, instead it flags them as deleted.
The REST API endpoint does not exclude the deleted NotificationSetting objects. Thus, opening the notification preferences page raises NotificationRenderException.
Steps To Reproduce
Steps to reproduce the behavior:
- Ensure there's a superuser created in your project
- Add a new notification type in
openwisp_notifications/apps.pyusing theregister_notification_typemethod - Run
./manage.py populate_notification_preferencescommand - Remove the code which adds the new notification type
- Run
./manage.py populate_notification_preferencescommand which is supposed to delete NotificationSettings for undefined notification types. - Run django server and go to the user's notification preferences page
Expected behavior
User notification preferences are displayed.
Actual result
No notification preference is displayed. The application shows Error fetching notification settings. Please try again.
Other Notes
This bug was found while upgrading OpenWISP Controller from 1.1 to 1.2 (the api_task_error and api_task_recovery notification types were removed in openwisp-controller). Thus, the solution should also be tested manually with OpenWISP controller.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status