Merge pull request #25994 from edx/aj/bulk-email-provide-logo-from-bkend
Provide logo URL from the backend
This commit is contained in:
@@ -13,7 +13,6 @@ the marketing site and blog).
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
@@ -643,3 +642,11 @@ def get_home_url():
|
||||
Return Dashboard page url
|
||||
"""
|
||||
return reverse('dashboard')
|
||||
|
||||
|
||||
def get_logo_url_for_email():
|
||||
"""
|
||||
Returns the url for the branded logo image for embedding in email templates.
|
||||
"""
|
||||
default_logo_url = getattr(settings, 'DEFAULT_EMAIL_LOGO_URL', None)
|
||||
return getattr(settings, 'LOGO_URL_PNG', None) or default_logo_url
|
||||
|
||||
@@ -4,7 +4,6 @@ This module contains celery task functions for handling the sending of bulk emai
|
||||
to a course.
|
||||
"""
|
||||
|
||||
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
@@ -41,6 +40,7 @@ from edx_django_utils.monitoring import set_code_owner_attribute
|
||||
from markupsafe import escape
|
||||
from six import text_type
|
||||
|
||||
from lms.djangoapps.branding.api import get_logo_url_for_email
|
||||
from lms.djangoapps.bulk_email.models import CourseEmail, Optout
|
||||
from lms.djangoapps.bulk_email.api import get_unsubscribed_link
|
||||
from lms.djangoapps.courseware.courses import get_course
|
||||
@@ -58,7 +58,6 @@ from common.djangoapps.util.string_utils import _has_non_ascii_characters
|
||||
|
||||
log = logging.getLogger('edx.celery.task')
|
||||
|
||||
|
||||
# Errors that an individual email is failing to be sent, and should just
|
||||
# be treated as a fail.
|
||||
SINGLE_EMAIL_FAILURE_ERRORS = (
|
||||
@@ -123,6 +122,7 @@ def _get_course_email_context(course):
|
||||
'course_end_date': course_end_date,
|
||||
'account_settings_url': '{}{}'.format(lms_root_url, reverse('account_settings')),
|
||||
'email_settings_url': '{}{}'.format(lms_root_url, reverse('dashboard')),
|
||||
'logo_url': get_logo_url_for_email(),
|
||||
'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
|
||||
'year': timezone.now().year,
|
||||
}
|
||||
@@ -294,7 +294,6 @@ def send_course_email(entry_id, email_id, to_list, global_email_context, subtask
|
||||
send_exception = None
|
||||
new_subtask_status = None
|
||||
try:
|
||||
course_title = global_email_context['course_title']
|
||||
start_time = time.time()
|
||||
new_subtask_status, send_exception = _send_course_email(
|
||||
entry_id,
|
||||
|
||||
@@ -6,7 +6,6 @@ JSON views which the instructor dashboard requests.
|
||||
Many of these GETs may become PUTs in the future.
|
||||
"""
|
||||
|
||||
|
||||
import csv
|
||||
import json
|
||||
import logging
|
||||
@@ -315,8 +314,8 @@ def register_and_enroll_students(request, course_id): # pylint: disable=too-man
|
||||
"""
|
||||
|
||||
if not configuration_helpers.get_value(
|
||||
'ALLOW_AUTOMATED_SIGNUPS',
|
||||
settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False),
|
||||
'ALLOW_AUTOMATED_SIGNUPS',
|
||||
settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False),
|
||||
):
|
||||
return HttpResponseForbidden()
|
||||
|
||||
@@ -2959,8 +2958,8 @@ def invalidate_certificate(request, generated_certificate, certificate_invalidat
|
||||
:return: dict object containing updated certificate invalidation data.
|
||||
"""
|
||||
if CertificateInvalidation.get_certificate_invalidations(
|
||||
generated_certificate.course_id,
|
||||
generated_certificate.user,
|
||||
generated_certificate.course_id,
|
||||
generated_certificate.user,
|
||||
):
|
||||
raise ValueError(
|
||||
_(u"Certificate of {user} has already been invalidated. Please check your spelling and retry.").format(
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Context dictionary for templates that use the ace_common base template.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
|
||||
from lms.djangoapps.branding.api import get_logo_url_for_email
|
||||
from common.djangoapps.edxmako.shortcuts import marketing_link
|
||||
from openedx.core.djangoapps.theming.helpers import get_config_value_from_site_or_settings
|
||||
|
||||
@@ -16,7 +16,6 @@ def get_base_template_context(site):
|
||||
"""
|
||||
# When on LMS and a dashboard is available, use that as the dashboard url.
|
||||
# Otherwise, use the home url instead.
|
||||
default_logo_url = getattr(settings, 'DEFAULT_EMAIL_LOGO_URL')
|
||||
try:
|
||||
dashboard_url = reverse('dashboard')
|
||||
except NoReverseMatch:
|
||||
@@ -38,5 +37,5 @@ def get_base_template_context(site):
|
||||
'CONTACT_MAILING_ADDRESS', site=site, site_config_name='contact_mailing_address'),
|
||||
'social_media_urls': get_config_value_from_site_or_settings('SOCIAL_MEDIA_FOOTER_URLS', site=site),
|
||||
'mobile_store_urls': get_config_value_from_site_or_settings('MOBILE_STORE_URLS', site=site),
|
||||
'logo_url': getattr(settings, 'LOGO_URL_PNG', default_logo_url),
|
||||
'logo_url': get_logo_url_for_email(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user