If a user is in several organizations,
they will receive multiple identical notifications.
The reason for this is that the database query, which determines which user should receive the notification, can return a user multiple times.
Steps to replicate the issue:
- Do a fresh installation of openwisp-controller as described in the docs and launch the development server.
- Re-enable the "default" notification type by commenting out the lines 268 to
272 in openwisp_controller/config/apps.py.
- Log In to the admin site with the user created during installation.
- Create a second organization.
- Make the user organization user of the two organizations (
is_admin is not required).
- Create a nottification type setting for the type "Default Type" with organization
default, web notification checked and email notification checked.
- Then create a notification with the following command:
env/bin/python tests/manage.py create_notification
- This user will then receive the notification twice.
If a user is in several organizations,
they will receive multiple identical notifications.
The reason for this is that the database query, which determines which user should receive the notification, can return a user multiple times.
Steps to replicate the issue:
272inopenwisp_controller/config/apps.py.is_adminis not required).default, web notification checked and email notification checked.env/bin/python tests/manage.py create_notification