Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:natgeosociety/django-broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtemple29 committed Nov 16, 2017
2 parents dc48e5f + 16ac6ab commit e723201
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions broadcasts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"""
__version_info__ = {
'major': 0,
'minor': 6,
'micro': 4,
'minor': 7,
'micro': 0,
'releaselevel': 'final',
'serial': 1
}
Expand Down
6 changes: 3 additions & 3 deletions broadcasts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def get_messages(request):
"""
Get messages for the user
"""
import urlparse
if request.user.is_authenticated():
msgs = BroadcastMessage.objects.current().for_auth_users()
else:
Expand All @@ -58,9 +59,8 @@ def get_messages(request):
msgs = msgs.exclude(pk__in=list(excluded))

# filter them by the HTTP_REFERER
host = "https://" if request.is_secure() else "http://"
host += request.get_host()
path = request.META.get('HTTP_REFERER', '/').replace(host, "")
url_parts = urlparse.urlparse(request.META.get('HTTP_REFERER', '/'))
path = url_parts.path
valid_messages = [msg for msg in msgs if re.match(msg.url_target, path)]
msg_list = []
for msg in valid_messages:
Expand Down

0 comments on commit e723201

Please sign in to comment.