Skip to content

Commit

Permalink
Proversity/hide global message (openedx#693)
Browse files Browse the repository at this point in the history
* ENH: hiding global message behind a flag, global shows all unless microsite is off
  • Loading branch information
Nico van Niekerk authored Mar 27, 2018
1 parent 764e94e commit 080cd3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
25 changes: 14 additions & 11 deletions common/djangoapps/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"""

import logging

from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from django.conf import settings
from .models import GlobalStatusMessage

log = logging.getLogger(__name__)
Expand All @@ -15,14 +16,16 @@ def get_site_status_msg(course_key):
Caches the message by course.
"""
try:
# The current() value for GlobalStatusMessage is cached.
if not GlobalStatusMessage.current().enabled:
return None
must_show_message = configuration_helpers.get_value('show_global_message', settings.SHOW_GLOBAL_MESSAGE)
if must_show_message:
try:
# The current() value for GlobalStatusMessage is cached.
if not GlobalStatusMessage.current().enabled:
return None

return GlobalStatusMessage.current().full_message(course_key)
# Make as general as possible, because something broken here should not
# bring down the whole site.
except: # pylint: disable=bare-except
log.exception("Error while getting a status message.")
return None
return GlobalStatusMessage.current().full_message(course_key)
# Make as general as possible, because something broken here should not
# bring down the whole site.
except: # pylint: disable=bare-except
log.exception("Error while getting a GlobalStatusMessage")
return None
3 changes: 3 additions & 0 deletions lms/envs/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,3 +1147,6 @@
########################## Derive Any Derived Settings #######################

derive_settings(__name__)

########################## Derive Any Derived Settings #######################
SHOW_GLOBAL_MESSAGE = ENV_TOKENS.get('SHOW_GLOBAL_MESSAGE', False)
2 changes: 1 addition & 1 deletion lms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
MEDIA_ROOT = "/edx/var/edxapp/uploads"
ORA2_FILEUPLOAD_BACKEND = 'django'


SHOW_GLOBAL_MESSAGE = False
DEBUG = True
USE_I18N = True
DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = True
Expand Down

0 comments on commit 080cd3f

Please sign in to comment.