diff --git a/CHANGES.rst b/CHANGES.rst index a42ec92f9a53149ce26332bff518883f23e15946..2014348334785a9d9b6115aa0e5f7bb6796f8c9d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,12 @@ Changes ======= +Version 2025.1.9 (released 2025-02-13) + +- Allow secondary email address to be removed again +- Add "id" to the fake entity created by `SystemEntityProxy._resolve()` + + Version 2025.1.8 (released 2025-02-13) - Explicitly set calculated value for `THEME_SITEURL` in the config diff --git a/invenio_config_tuw/__init__.py b/invenio_config_tuw/__init__.py index a902ac3ac244dab1aec9fd1eca6a89960d726f71..f3aeeaaec3d7b39a093d7172a80944c07258c271 100644 --- a/invenio_config_tuw/__init__.py +++ b/invenio_config_tuw/__init__.py @@ -9,6 +9,6 @@ from .ext import InvenioConfigTUW -__version__ = "2025.1.8" +__version__ = "2025.1.9" __all__ = ("__version__", "InvenioConfigTUW") diff --git a/invenio_config_tuw/notifications/entity_resolvers.py b/invenio_config_tuw/notifications/entity_resolvers.py index e6fc90ad6c2157bdbaa8303f524249077ed6a78d..5d2c0430887655dbed8063a28550881dd638d45b 100644 --- a/invenio_config_tuw/notifications/entity_resolvers.py +++ b/invenio_config_tuw/notifications/entity_resolvers.py @@ -27,7 +27,11 @@ class SystemEntityProxy(EntityProxy): Since this will mostly be used in Jinja templates, it being a dictionary and not an actual object is fine. """ - return {"username": "system", "user_profile": {"full_name": "System"}} + return { + "id": "system", + "username": "system", + "user_profile": {"full_name": "System"}, + } def pick_resolved_fields(self, identity, resolved_dict): """Select which fields to return when resolving the reference.""" diff --git a/invenio_config_tuw/users/schemas.py b/invenio_config_tuw/users/schemas.py index 3134866f4e9731a34ff3c885b69d6663451a8e08..41e10402a760b19e3bc0bf425ecb2d263e243738 100644 --- a/invenio_config_tuw/users/schemas.py +++ b/invenio_config_tuw/users/schemas.py @@ -15,7 +15,7 @@ from invenio_users_resources.services.schemas import ( NotificationPreferences, UserProfileSchema, ) -from marshmallow import fields +from marshmallow import fields, pre_load # profile @@ -33,6 +33,14 @@ class TUWNotificationPreferencesSchema(NotificationPreferences): secondary_email = fields.Email() + @pre_load + def remove_empty_secondary_mail(self, data, **kwargs): + """Turn empty string for secondary emails into `None`.""" + if not data.get("secondary_email"): + data.pop("secondary_email", None) + + return data + class TUWUserPreferencesSchema(UserPreferencesSchema): """User preferences schema with TU Wien extensions."""