Skip to content

Commit

Permalink
fixed online users in rooms, added session_expire_at_browser_close se…
Browse files Browse the repository at this point in the history
…tting
  • Loading branch information
Jpadilla1 committed Apr 30, 2014
1 parent efeb994 commit 03ebe21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/chats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def get_context_data(self, **kwargs):
context['room_messages'] = Message.objects.filter(room=context['room'])
if context['room_messages'].count() > 0:
context['room_message_last'] = context['room_messages'].last().id
users = User.objects.filter(
last_login__gt=self.request.user.last_logged_out,
is_active__exact=1, ).order_by('-last_login')
users = ChatRoom.objects.get(
slug=self.kwargs['slug']).members.filter(
last_login__gt=self.request.user.last_logged_out,
is_active__exact=1, ).order_by('-last_login')
context['online_users'] = users
return context

Expand Down
2 changes: 2 additions & 0 deletions chatrooms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,5 @@

# Allow all host headers
ALLOWED_HOSTS = ['*']

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

0 comments on commit 03ebe21

Please sign in to comment.