From f2e4b7c93c00b9aa69d594a6fee82670aeb565b2 Mon Sep 17 00:00:00 2001 From: Felix Rindt Date: Thu, 10 Aug 2023 08:44:03 +0200 Subject: [PATCH 1/5] replace SITE_URL template var with template tag --- ephios/core/context.py | 1 - ephios/core/plugins.py | 2 +- ephios/core/services/mail/send.py | 3 +++ ephios/core/services/notifications/types.py | 1 - ephios/core/services/password_reset.py | 1 - ephios/core/templates/core/account_updated_email.html | 3 ++- ephios/core/templates/core/mails/base.html | 7 ++++--- ephios/core/templates/core/mails/new_account_email.html | 3 ++- ephios/core/templates/core/mails/new_event.html | 3 ++- ephios/core/templates/core/mails/notification.html | 3 ++- ephios/core/templates/core/settings/settings_calendar.html | 3 ++- ephios/core/templatetags/settings_extras.py | 5 +++++ ephios/extra/templatetags/__init__.py | 0 13 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 ephios/extra/templatetags/__init__.py diff --git a/ephios/core/context.py b/ephios/core/context.py index 90a518ac0..84ee559c6 100644 --- a/ephios/core/context.py +++ b/ephios/core/context.py @@ -21,6 +21,5 @@ def ephios_base_context(request): "footer": footer, "LANGUAGE_CODE": get_language(), "ephios_version": settings.EPHIOS_VERSION, - "SITE_URL": settings.GET_SITE_URL(), "PWA_APP_ICONS": settings.PWA_APP_ICONS, } diff --git a/ephios/core/plugins.py b/ephios/core/plugins.py index 3e0fa058b..3140b8046 100644 --- a/ephios/core/plugins.py +++ b/ephios/core/plugins.py @@ -48,7 +48,7 @@ def is_receiver_path_enabled(searchpath): relies in a module that is either an enabled plugin or considered ephios core. Uses a cache that gets reset when enabled plugins preference changes. """ - enabled_paths = settings.EPHIOS_CORE_MODULES + [ + enabled_paths = settings.EPHIOS_APP_MODULES + [ plugin.module for plugin in get_enabled_plugins() ] # Not using `startwith`, as we don't want to match "ephios_foobar" against "ephios_foo" diff --git a/ephios/core/services/mail/send.py b/ephios/core/services/mail/send.py index 577edb60c..916b84cba 100644 --- a/ephios/core/services/mail/send.py +++ b/ephios/core/services/mail/send.py @@ -21,6 +21,7 @@ def send_mail( from_email=None, cc=None, bcc=None, + attachments=None, is_autogenerated=True, ): headers = {} @@ -41,6 +42,8 @@ def send_mail( if html: html_part = prepare_html_part(html) email.attach_alternative(html_part, "multipart/related") + if attachments: + ... email.send() diff --git a/ephios/core/services/notifications/types.py b/ephios/core/services/notifications/types.py index 2ba32f8ca..9b541089a 100644 --- a/ephios/core/services/notifications/types.py +++ b/ephios/core/services/notifications/types.py @@ -76,7 +76,6 @@ def get_render_context(cls, notification): "organization_name": global_preferences_registry.manager().get( "general__organization_name" ), - "SITE_URL": settings.GET_SITE_URL(), } @classmethod diff --git a/ephios/core/services/password_reset.py b/ephios/core/services/password_reset.py index 823e2a669..8490867c2 100644 --- a/ephios/core/services/password_reset.py +++ b/ephios/core/services/password_reset.py @@ -25,7 +25,6 @@ def password_changed(self, password, user): { "subject": _("Your ephios password has been changed"), "body": text_content, - "SITE_URL": settings.GET_SITE_URL(), }, ) message = EmailMultiAlternatives( diff --git a/ephios/core/templates/core/account_updated_email.html b/ephios/core/templates/core/account_updated_email.html index 48beede8b..35856e483 100644 --- a/ephios/core/templates/core/account_updated_email.html +++ b/ephios/core/templates/core/account_updated_email.html @@ -1,7 +1,8 @@ {% extends "email_base.html" %} +{% load settings_extras %} {% load i18n %} {% block content %} {% trans "You're receiving this email because your account at ephios has been updated." %} - {% trans "You can see the changes in your profile:" %} {{ SITE_URL }}{{ url }} + {% trans "You can see the changes in your profile:" %} {% site_url %}{{ url }} {% trans "Your username is your email address:" %} {{ email }} {% endblock %} \ No newline at end of file diff --git a/ephios/core/templates/core/mails/base.html b/ephios/core/templates/core/mails/base.html index a5c4f79db..d11b80169 100644 --- a/ephios/core/templates/core/mails/base.html +++ b/ephios/core/templates/core/mails/base.html @@ -1,3 +1,4 @@ +{% load settings_extras %} {% load rich_text %} {% load i18n %} @@ -119,7 +120,7 @@ {% block content %} {% endblock %} diff --git a/ephios/core/templates/core/mails/new_account_email.html b/ephios/core/templates/core/mails/new_account_email.html index 430d71f13..4b2112fad 100644 --- a/ephios/core/templates/core/mails/new_account_email.html +++ b/ephios/core/templates/core/mails/new_account_email.html @@ -1,4 +1,5 @@ {% extends "core/mails/notification.html" %} +{% load settings_extras %} {% load i18n %} {% block content %} @@ -7,7 +8,7 @@ {% translate "Please go to the following page and choose a new password:" %} {% block reset_link %} {% trans "Set password" %} + {% site_url %}{% url 'password_reset_confirm' uidb64=notification.data.uidb64 token=notification.data.token %}">{% trans "Set password" %} {% endblock %} {% translate "Your username is your email address:" %} {{ notification.user.email }} diff --git a/ephios/core/templates/core/mails/new_event.html b/ephios/core/templates/core/mails/new_event.html index c18291692..4a8b8181c 100644 --- a/ephios/core/templates/core/mails/new_event.html +++ b/ephios/core/templates/core/mails/new_event.html @@ -1,4 +1,5 @@ {% extends "core/mails/notification.html" %} +{% load settings_extras %} {% load i18n %} {% block content %} @@ -31,7 +32,7 @@

{% endblock %} diff --git a/ephios/core/templates/core/mails/notification.html b/ephios/core/templates/core/mails/notification.html index ef7173aa4..0428ae7d8 100644 --- a/ephios/core/templates/core/mails/notification.html +++ b/ephios/core/templates/core/mails/notification.html @@ -1,4 +1,5 @@ {% extends "core/mails/base.html" %} +{% load settings_extras %} {% load rich_text %} {% load i18n %} @@ -20,7 +21,7 @@ {% block header %}
- + {{ organization_name }}
diff --git a/ephios/core/templates/core/settings/settings_calendar.html b/ephios/core/templates/core/settings/settings_calendar.html index 0df3abdc2..80964fbb3 100644 --- a/ephios/core/templates/core/settings/settings_calendar.html +++ b/ephios/core/templates/core/settings/settings_calendar.html @@ -1,4 +1,5 @@ {% extends "core/settings/settings_base.html" %} +{% load settings_extras %} {% load static %} {% load crispy_forms_filters %} {% load i18n %} @@ -10,7 +11,7 @@

{% translate "Calendar" %}

{% endblock %} diff --git a/ephios/core/templates/core/settings/settings_calendar.html b/ephios/core/templates/core/settings/settings_calendar.html index 80964fbb3..2f04aa3c1 100644 --- a/ephios/core/templates/core/settings/settings_calendar.html +++ b/ephios/core/templates/core/settings/settings_calendar.html @@ -10,8 +10,9 @@

{% translate "Calendar" %}

{% translate "You can subscribe to a calendar containing all events that you participate in. Most calendars (e.g. Google Calendar) offer this feature. This allows you to see all events in your personal calendar. To activate this, you need to copy the address of the following link and subscribe to the URL." %}

+ {% url "core:user_event_feed" userprofile.calendar_token as feed_location %}