mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-11 15:34:15 +00:00
Fix email notification setting (#3832)
* Coerce setting value to a boolean * Ignore inactive users when sending notification emails * Only send UI notifications to active users * Fixes for unit tests
This commit is contained in:
@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
from allauth.account.models import EmailAddress
|
||||
|
||||
import common.models
|
||||
import InvenTree.helpers
|
||||
import InvenTree.tasks
|
||||
from plugin import InvenTreePlugin
|
||||
from plugin.mixins import BulkNotificationMethod, SettingsMixin
|
||||
@ -61,7 +62,12 @@ class CoreNotificationsPlugin(SettingsMixin, InvenTreePlugin):
|
||||
allowed_users = []
|
||||
|
||||
for user in self.targets:
|
||||
allows_emails = self.usersetting(user)
|
||||
|
||||
if not user.is_active:
|
||||
# Ignore any users who have been deactivated
|
||||
continue
|
||||
|
||||
allows_emails = InvenTree.helpers.str2bool(self.usersetting(user))
|
||||
|
||||
if allows_emails:
|
||||
allowed_users.append(user)
|
||||
|
Reference in New Issue
Block a user