Alias ZulipDesktop client to website

(imported from commit 91e549bbc67b9d9f5edf35522b608aa397547edd)
This commit is contained in:
Leo Franchi 2014-02-13 08:28:08 -05:00
parent cf13874c9d
commit e0efae4d59
1 changed files with 13 additions and 0 deletions

View File

@ -1503,8 +1503,21 @@ def send_presence_changed(user_profile, presence):
presence={presence_dict['client']: presence.to_dict()})
send_event(event, active_user_ids(user_profile.realm))
def consolidate_client(client):
# The web app reports a client as 'website'
# The desktop app reports a client as ZulipDesktop
# due to it setting a custom user agent. We want both
# to count as web users
# Alias ZulipDesktop to website
if client.name in ['ZulipDesktop']:
return get_client('website')
else:
return client
@statsd_increment('user_presence')
def do_update_user_presence(user_profile, client, log_time, status):
client = consolidate_client(client)
(presence, created) = UserPresence.objects.get_or_create(
user_profile = user_profile,
client = client,