improvement: correctly set email logo

Previously, the logo included in emails was loaded from edX' CDN. Here, we make
sure that the logo is actually the same as the site logo. Because the logo may
be theme-specific, we need to compute the logo url at runtime, and use a
lazily-evaluated string.

Close #447.
This commit is contained in:
Régis Behmo 2021-09-02 11:58:05 +02:00 committed by Régis Behmo
parent 750bdca04d
commit eef3c15c17
2 changed files with 17 additions and 2 deletions

View File

@ -4,13 +4,13 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Improvement] Make sure that the logo included in email notifications (including discussion responses) is the same as the site logo.
- [Bugfix] Install IPython directly from pypi instead of installing it from source (the reason it was installed from source is no longer relevant). The effect of this shall speed up the process of building the openedx-dev Docker image.
- [Feature] Add "openedx-dockerfile-post-git-checkout" patch.
- [Improvement] In the "openedx" Docker images, convert git patches to cherry-picks for a cleaner source tree.
- 💥[Feature] Make it possible to override local job configuration. This deprecates the older model for running jobs which dates back from a long time ago.
- [Bugfix] Fix a bug that prevented connecting to external MongoDB instances.
- [Bugfix] Install Ipython directly from pypy instead of installing it from source (the reason it was installed from source is no longer relevant). The effect of this shall speed up the process of openedx-dev Docker image.
## v12.0.4 (2021-08-12)
- [Security] Apply security patch [28442](https://github.com/edx/edx-platform/pull/28442).

View File

@ -18,6 +18,21 @@ COURSE_ABOUT_VISIBILITY_PERMISSION = "see_about_page"
# Allow insecure oauth2 for local interaction with local containers
OAUTH_ENFORCE_SECURE = False
# Email settings
class LazyStaticAbsoluteUrl:
"""
Evaluates a static asset path lazily at runtime
"""
def __init__(self, path):
self.path = path
def __str__(self):
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
return settings.LMS_ROOT_URL + staticfiles_storage.url(self.path)
# We need a lazily-computed logo url to capture the url of the theme-specific logo.
DEFAULT_EMAIL_LOGO_URL = LazyStaticAbsoluteUrl("images/logo.png")
# Create folders if necessary
for folder in [DATA_DIR, LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE, ORA2_FILEUPLOAD_ROOT]:
if not os.path.exists(folder):