Commit a0217b73 by Chris Dodge

tweeks getting digests to work in mcka

parent e55d85a6
...@@ -81,7 +81,7 @@ class Command(BaseCommand): ...@@ -81,7 +81,7 @@ class Command(BaseCommand):
to_timestamp = datetime.datetime.now(pytz.UTC) to_timestamp = datetime.datetime.now(pytz.UTC)
preference_name = const.NOTIFICATION_DAILY_DIGEST_PREFERENCE_NAME preference_name = const.NOTIFICATION_DAILY_DIGEST_PREFERENCE_NAME
subject = const.NOTIFICATION_DAILY_DIGEST_SUBJECT subject = const.NOTIFICATION_DAILY_DIGEST_SUBJECT
from_email = const.NOTIFICATION_DIGEST_FROM_ADDRESS from_email = const.NOTIFICATION_EMAIL_FROM_ADDRESS
if namespace == "All": if namespace == "All":
digests_sent = send_notifications_digest(from_timestamp, to_timestamp, preference_name, subject, from_email) digests_sent = send_notifications_digest(from_timestamp, to_timestamp, preference_name, subject, from_email)
...@@ -99,7 +99,7 @@ class Command(BaseCommand): ...@@ -99,7 +99,7 @@ class Command(BaseCommand):
to_timestamp = datetime.datetime.now(pytz.UTC) to_timestamp = datetime.datetime.now(pytz.UTC)
preference_name = const.NOTIFICATION_WEEKLY_DIGEST_PREFERENCE_NAME preference_name = const.NOTIFICATION_WEEKLY_DIGEST_PREFERENCE_NAME
subject = const.NOTIFICATION_WEEKLY_DIGEST_SUBJECT subject = const.NOTIFICATION_WEEKLY_DIGEST_SUBJECT
from_email = const.NOTIFICATION_DIGEST_FROM_ADDRESS from_email = const.NOTIFICATION_EMAIL_FROM_ADDRESS
if namespace == "All": if namespace == "All":
digests_sent = send_notifications_digest(from_timestamp, to_timestamp, preference_name, subject, from_email) digests_sent = send_notifications_digest(from_timestamp, to_timestamp, preference_name, subject, from_email)
......
...@@ -106,7 +106,7 @@ class NamespaceEnrollmentsScopeResolver(NotificationUserScopeResolver): ...@@ -106,7 +106,7 @@ class NamespaceEnrollmentsScopeResolver(NotificationUserScopeResolver):
if scope_context['fields'].get('last_name'): if scope_context['fields'].get('last_name'):
fields.append('last_name') fields.append('last_name')
else: else:
fields =['id', 'email', 'first_name', 'last_name'] fields = ['id', 'email', 'first_name', 'last_name']
query = query.values(*fields) query = query.values(*fields)
query = query.filter( query = query.filter(
...@@ -135,6 +135,20 @@ class StudentEmailScopeResolver(NotificationUserScopeResolver): ...@@ -135,6 +135,20 @@ class StudentEmailScopeResolver(NotificationUserScopeResolver):
if not user_id: if not user_id:
return None return None
return User.objects.values_list('email', flat=True).filter( if 'fields' in scope_context:
id=user_id fields = []
) if scope_context['fields'].get('id'):
fields.append('id')
if scope_context['fields'].get('email'):
fields.append('email')
if scope_context['fields'].get('first_name'):
fields.append('first_name')
if scope_context['fields'].get('last_name'):
fields.append('last_name')
else:
fields = ['id', 'email', 'first_name', 'last_name']
return User.objects.values(*fields).filter(id=user_id)
...@@ -565,13 +565,46 @@ MIDDLEWARE_CLASSES = tuple(_class for _class in MIDDLEWARE_CLASSES if _class not ...@@ -565,13 +565,46 @@ MIDDLEWARE_CLASSES = tuple(_class for _class in MIDDLEWARE_CLASSES if _class not
##### EDX-NOTIFICATIONS ###### ##### EDX-NOTIFICATIONS ######
NOTIFICATION_CLICK_LINK_URL_MAPS = ENV_TOKENS.get('NOTIFICATION_CLICK_LINK_URL_MAPS', NOTIFICATION_CLICK_LINK_URL_MAPS) NOTIFICATION_CLICK_LINK_URL_MAPS = ENV_TOKENS.get(
NOTIFICATION_STORE_PROVIDER = ENV_TOKENS.get('NOTIFICATION_STORE_PROVIDER', NOTIFICATION_STORE_PROVIDER) 'NOTIFICATION_CLICK_LINK_URL_MAPS',
NOTIFICATION_CHANNEL_PROVIDERS = ENV_TOKENS.get('NOTIFICATION_CHANNEL_PROVIDERS', NOTIFICATION_CHANNEL_PROVIDERS) NOTIFICATION_CLICK_LINK_URL_MAPS
)
NOTIFICATION_STORE_PROVIDER = ENV_TOKENS.get(
'NOTIFICATION_STORE_PROVIDER',
NOTIFICATION_STORE_PROVIDER
)
NOTIFICATION_CHANNEL_PROVIDERS = ENV_TOKENS.get(
'NOTIFICATION_CHANNEL_PROVIDERS',
NOTIFICATION_CHANNEL_PROVIDERS
)
NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS = ENV_TOKENS.get( NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS = ENV_TOKENS.get(
'NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS', 'NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS',
NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS
) )
NOTIFICATION_MAX_LIST_SIZE = ENV_TOKENS.get('NOTIFICATION_MAX_LIST_SIZE', NOTIFICATION_MAX_LIST_SIZE) NOTIFICATION_MAX_LIST_SIZE = ENV_TOKENS.get(
'NOTIFICATION_MAX_LIST_SIZE',
NOTIFICATION_MAX_LIST_SIZE
)
NOTIFICATION_DAILY_DIGEST_SUBJECT = ENV_TOKENS.get(
'NOTIFICATION_DAILY_DIGEST_SUBJECT',
NOTIFICATION_DAILY_DIGEST_SUBJECT
)
NOTIFICATION_WEEKLY_DIGEST_SUBJECT = ENV_TOKENS.get(
'NOTIFICATION_WEEKLY_DIGEST_SUBJECT',
NOTIFICATION_WEEKLY_DIGEST_SUBJECT
)
NOTIFICATION_BRANDED_DEFAULT_LOGO = ENV_TOKENS.get(
'NOTIFICATION_BRANDED_DEFAULT_LOGO',
NOTIFICATION_BRANDED_DEFAULT_LOGO
)
NOTIFICATION_EMAIL_FROM_ADDRESS = ENV_TOKENS.get(
'NOTIFICATION_EMAIL_FROM_ADDRESS',
NOTIFICATION_EMAIL_FROM_ADDRESS
)
NOTIFICATION_EMAIL_CLICK_LINK_ROOT = ENV_TOKENS.get(
'NOTIFICATION_EMAIL_CLICK_LINK_ROOT',
NOTIFICATION_EMAIL_CLICK_LINK_ROOT
)
XBLOCK_SETTINGS = ENV_TOKENS.get('XBLOCK_SETTINGS', {}) XBLOCK_SETTINGS = ENV_TOKENS.get('XBLOCK_SETTINGS', {})
...@@ -296,11 +296,11 @@ FEATURES = { ...@@ -296,11 +296,11 @@ FEATURES = {
# Enables the new navigation template and styles. This should be enabled # Enables the new navigation template and styles. This should be enabled
# when the styles appropriately match the edX.org website. # when the styles appropriately match the edX.org website.
'ENABLE_NEW_EDX_HEADER': False, 'ENABLE_NEW_EDX_HEADER': False,
# When a logged in user goes to the homepage ('/') should the user be # When a logged in user goes to the homepage ('/') should the user be
# redirected to the dashboard - this is default Open edX behavior. Set to # redirected to the dashboard - this is default Open edX behavior. Set to
# False to not redirect the user # False to not redirect the user
'ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER': True, 'ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER': True,
# When a user goes to the homepage ('/') the user see the # When a user goes to the homepage ('/') the user see the
# courses listed in the announcement dates order - this is default Open edX behavior. # courses listed in the announcement dates order - this is default Open edX behavior.
...@@ -1650,12 +1650,12 @@ INSTALLED_APPS = ( ...@@ -1650,12 +1650,12 @@ INSTALLED_APPS = (
'survey', 'survey',
'lms.djangoapps.lms_xblock', 'lms.djangoapps.lms_xblock',
# EDX API application # EDX API application
'api_manager', 'api_manager',
# Social Engagement # Social Engagement
'social_engagement', 'social_engagement',
) )
######################### MARKETING SITE ############################### ######################### MARKETING SITE ###############################
...@@ -2100,6 +2100,12 @@ NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS = { ...@@ -2100,6 +2100,12 @@ NOTIFICATION_CHANNEL_PROVIDER_TYPE_MAPS = {
'*': 'durable', # default global mapping '*': 'durable', # default global mapping
} }
NOTIFICATION_DAILY_DIGEST_SUBJECT = "Your dialy digest of Notifications from Open edX"
NOTIFICATION_WEEKLY_DIGEST_SUBJECT = "Your weekly digest of Notifications from Open edX"
NOTIFICATION_BRANDED_DEFAULT_LOGO = 'edx_notifications/img/edx-openedx-logo-tag.png'
NOTIFICATION_EMAIL_FROM_ADDRESS = ''
NOTIFICATION_EMAIL_CLICK_LINK_ROOT = 'http://localhost'
# Country code overrides # Country code overrides
# Used by django-countries # Used by django-countries
COUNTRIES_OVERRIDE = { COUNTRIES_OVERRIDE = {
......
...@@ -27,7 +27,7 @@ for pkg_name in ['track.contexts', 'track.middleware', 'dd.dogapi']: ...@@ -27,7 +27,7 @@ for pkg_name in ['track.contexts', 'track.middleware', 'dd.dogapi']:
################################ EMAIL ######################################## ################################ EMAIL ########################################
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses
FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms) FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms)
...@@ -48,7 +48,7 @@ if FEATURES.get('PROFILER'): ...@@ -48,7 +48,7 @@ if FEATURES.get('PROFILER'):
# dashboard to the Analytics Dashboard. # dashboard to the Analytics Dashboard.
ANALYTICS_DASHBOARD_URL = None ANALYTICS_DASHBOARD_URL = None
################################ DEBUG TOOLBAR ################################ ################################ DEBUG TOOLBAR ################################
FEATURES['DEBUG_TOOLBAR'] = True FEATURES['DEBUG_TOOLBAR'] = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment