From 7e43cd56243807b639ec47a4675cfdd31d597c6f Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Fri, 16 Jun 2017 09:04:59 +0500 Subject: [PATCH] get_device_browser: Fix browser string for mobile. Now get_device_browser() returns 'Zulip' for 'ZulipAndroid' and 'ZulipMobile'. --- zerver/signals.py | 2 ++ zerver/tests/test_new_users.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/zerver/signals.py b/zerver/signals.py index 398635203e..bacfede89c 100644 --- a/zerver/signals.py +++ b/zerver/signals.py @@ -27,6 +27,8 @@ def get_device_browser(user_agent): return "Internet Explorer" elif "edge" in user_agent: return "Edge" + elif "zulip" in user_agent: + return "Zulip" else: return None diff --git a/zerver/tests/test_new_users.py b/zerver/tests/test_new_users.py index c987301cc5..f307151440 100644 --- a/zerver/tests/test_new_users.py +++ b/zerver/tests/test_new_users.py @@ -87,6 +87,8 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase): ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) ' + 'AppleWebKit/602.3.12 (KHTML, like Gecko) ' + 'Version/10.0.2 Safari/602.3.12', 'Safari', 'MacOS'), + ('ZulipAndroid/1.0', 'Zulip', 'Android'), + ('ZulipMobile/1.0', 'Zulip', None), ('', None, None), ]