diff --git a/src/ephios/core/forms/users.py b/src/ephios/core/forms/users.py index 91ef954ad..04b2d1e8c 100644 --- a/src/ephios/core/forms/users.py +++ b/src/ephios/core/forms/users.py @@ -347,8 +347,7 @@ def save(self, commit=True): Q(id__in=self.cleaned_data["groups"]) | Q(id__in=(g.id for g in self.locked_groups)) ) ) - # if the user is re-activated after the email has been deemed invalid, reset the flag - if userprofile.is_active and userprofile.email_invalid: + if "email" in self.changed_data: userprofile.email_invalid = False userprofile.save() return userprofile diff --git a/src/ephios/core/migrations/0039_alter_userprofile_disabled_notifications.py b/src/ephios/core/migrations/0039_alter_userprofile_disabled_notifications.py new file mode 100644 index 000000000..4023958b2 --- /dev/null +++ b/src/ephios/core/migrations/0039_alter_userprofile_disabled_notifications.py @@ -0,0 +1,24 @@ +# Generated by Django 5.2.13 on 2026-04-20 19:46 + +from django.db import migrations, models + +import ephios.extra.json + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0038_eventtype_default_description"), + ] + + operations = [ + migrations.AlterField( + model_name="userprofile", + name="disabled_notifications", + field=models.JSONField( + blank=True, + decoder=ephios.extra.json.CustomJSONDecoder, + default=list, + encoder=ephios.extra.json.CustomJSONEncoder, + ), + ), + ] diff --git a/src/ephios/core/models/users.py b/src/ephios/core/models/users.py index 80619fa1d..6eae9bdfb 100644 --- a/src/ephios/core/models/users.py +++ b/src/ephios/core/models/users.py @@ -116,7 +116,7 @@ class UserProfile(guardian.mixins.GuardianUserMixin, PermissionsMixin, AbstractB choices=settings.LANGUAGES, ) disabled_notifications = JSONField( - default=list, encoder=CustomJSONEncoder, decoder=CustomJSONDecoder + default=list, encoder=CustomJSONEncoder, decoder=CustomJSONDecoder, blank=True ) USERNAME_FIELD = "email" diff --git a/src/ephios/core/services/notifications/backends.py b/src/ephios/core/services/notifications/backends.py index 0874af03f..9f7498935 100644 --- a/src/ephios/core/services/notifications/backends.py +++ b/src/ephios/core/services/notifications/backends.py @@ -102,7 +102,7 @@ def should_send(cls, notification): def user_prefers_sending(cls, notification): if not notification.user: return True - if not notification.user.is_active or notification.user.email_invalid: + if not notification.user.is_active: return False if ( acting_user := notification.data.get("acting_user", None) diff --git a/src/ephios/core/templates/core/home.html b/src/ephios/core/templates/core/home.html index ad9bd3c18..df6b1b370 100644 --- a/src/ephios/core/templates/core/home.html +++ b/src/ephios/core/templates/core/home.html @@ -16,6 +16,14 @@ {% endblock %} +{% block messages %} + {% if request.user.email_invalid %} + + {% endif %} +{% endblock %} + {% block content %}

{% blocktranslate trimmed with organization_name=global_preferences.general__organization_name %} diff --git a/src/ephios/core/templates/core/settings/settings_personal_data.html b/src/ephios/core/templates/core/settings/settings_personal_data.html index 11e1b9bf2..3347b2cee 100644 --- a/src/ephios/core/templates/core/settings/settings_personal_data.html +++ b/src/ephios/core/templates/core/settings/settings_personal_data.html @@ -3,6 +3,14 @@ {% load crispy_forms_filters %} {% load i18n %} +{% block messages %} + {% if request.user.email_invalid %} + + {% endif %} +{% endblock %} + {% block settings_content %}
diff --git a/src/ephios/core/templates/core/userprofile_form.html b/src/ephios/core/templates/core/userprofile_form.html index 49f43d3e0..e3415fee7 100644 --- a/src/ephios/core/templates/core/userprofile_form.html +++ b/src/ephios/core/templates/core/userprofile_form.html @@ -36,9 +36,9 @@

{% translate "Add new user" %}

{% if userprofile.email_invalid %} {% endif %}