diff --git a/zerver/signals.py b/zerver/signals.py index e6f92ac3c3..f7e462ef2e 100644 --- a/zerver/signals.py +++ b/zerver/signals.py @@ -15,6 +15,8 @@ def get_device_browser(user_agent): user_agent = user_agent.lower() if "edge" in user_agent: return "Edge" + elif "opera" in user_agent or "opr/" in user_agent: + return "Opera" elif "chrome" in user_agent and "chromium" not in user_agent: return 'Chrome' elif "firefox" in user_agent and "seamonkey" not in user_agent and "chrome" not in user_agent: @@ -23,8 +25,6 @@ def get_device_browser(user_agent): return "Chromium" elif "safari" in user_agent and "chrome" not in user_agent and "chromium" not in user_agent: return "Safari" - elif "opera" in user_agent: - return "Opera" elif "msie" in user_agent or "trident" in user_agent: return "Internet Explorer" elif "zulip" in user_agent: diff --git a/zerver/tests/test_new_users.py b/zerver/tests/test_new_users.py index 589b81ad9e..e5d3f8e766 100644 --- a/zerver/tests/test_new_users.py +++ b/zerver/tests/test_new_users.py @@ -89,6 +89,9 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase): 'Version/10.0.2 Safari/602.3.12', 'Safari', 'MacOS'), ('ZulipAndroid/1.0', 'Zulip', 'Android'), ('ZulipMobile/1.0', 'Zulip', None), + ('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 ' + '(KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 ' + 'OPR/15.0.1147.100', 'Opera', 'Windows'), ('Mozilla/5.0 (Windows NT 10.0; <64-bit tags>) AppleWebKit/' ' (KHTML, like Gecko) Chrome/ Safari' '/ Edge/.'