mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
compatibility: Require version 16.2.96+ for our Android app.
This release is from 2018-08-22, a little over 100 days ago. It was the first release with the important fix so that when the server advises it to stop displaying a notification because the user has read the message (as the SEND_REMOVE_PUSH_NOTIFICATIONS server setting enables), the app doesn't instead replace the notification with a broken one reading "null". We have that setting running now on chat.zulip.org, and intend to roll it out more broadly soon. The `# take 0` thing is a slightly absurd workaround for the fact that our funky out-of-line way of marking lines to ignore doesn't work right if there are multiple such lines in a given file that are equal modulo leading and trailing whitespace.
This commit is contained in:
@@ -501,6 +501,7 @@ def build_custom_checkers(by_lang):
|
|||||||
'exclude': set(['zerver/tests']),
|
'exclude': set(['zerver/tests']),
|
||||||
'exclude_line': set([
|
'exclude_line': set([
|
||||||
# We don't want this string tagged for translation.
|
# We don't want this string tagged for translation.
|
||||||
|
('zerver/views/compatibility.py', 'return json_error("Client is too old") # take 0'),
|
||||||
('zerver/views/compatibility.py', 'return json_error("Client is too old")'),
|
('zerver/views/compatibility.py', 'return json_error("Client is too old")'),
|
||||||
]),
|
]),
|
||||||
'description': 'Argument to json_error should a literal string enclosed by _()'},
|
'description': 'Argument to json_error should a literal string enclosed by _()'},
|
||||||
|
|||||||
@@ -64,5 +64,12 @@ class CompatibilityTest(ZulipTestCase):
|
|||||||
def get(user_agent: str) -> HttpResponse:
|
def get(user_agent: str) -> HttpResponse:
|
||||||
return self.client_get("/compatibility", HTTP_USER_AGENT=user_agent)
|
return self.client_get("/compatibility", HTTP_USER_AGENT=user_agent)
|
||||||
|
|
||||||
self.assert_json_success(get('ZulipMobile/5.0'))
|
|
||||||
self.assert_json_error(get('ZulipInvalid/5.0'), "Client is too old")
|
self.assert_json_error(get('ZulipInvalid/5.0'), "Client is too old")
|
||||||
|
self.assert_json_success(get('ZulipMobile/5.0'))
|
||||||
|
self.assert_json_success(get('ZulipMobile/5.0 (iOS 11)'))
|
||||||
|
self.assert_json_success(get('ZulipMobile/5.0 (Androidish 9)'))
|
||||||
|
self.assert_json_error(get('ZulipMobile/5.0 (Android 9)'), "Client is too old")
|
||||||
|
self.assert_json_error(get('ZulipMobile/15.1.95 (Android 9)'), "Client is too old")
|
||||||
|
self.assert_json_error(get('ZulipMobile/16.1.94 (Android 9)'), "Client is too old")
|
||||||
|
self.assert_json_success(get('ZulipMobile/16.2.96 (Android 9)'))
|
||||||
|
self.assert_json_success(get('ZulipMobile/20.0.103 (Android 9)'))
|
||||||
|
|||||||
@@ -64,8 +64,19 @@ def find_mobile_os(user_agent: str) -> Optional[str]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
# Zulip Mobile release 16.2.96 was made 2018-08-22. It fixed a
|
||||||
|
# bug in our Android code that causes spammy, obviously-broken
|
||||||
|
# notifications once the "remove_push_notification" feature is
|
||||||
|
# enabled on the user's Zulip server.
|
||||||
|
android_min_app_version = '16.2.96'
|
||||||
|
|
||||||
def check_global_compatibility(request: HttpRequest) -> HttpResponse:
|
def check_global_compatibility(request: HttpRequest) -> HttpResponse:
|
||||||
user_agent = parse_user_agent(request.META["HTTP_USER_AGENT"])
|
user_agent = parse_user_agent(request.META["HTTP_USER_AGENT"])
|
||||||
if user_agent['name'] == "ZulipInvalid":
|
if user_agent['name'] == "ZulipInvalid":
|
||||||
|
return json_error("Client is too old") # take 0
|
||||||
|
if user_agent['name'] == "ZulipMobile":
|
||||||
|
user_os = find_mobile_os(request.META["HTTP_USER_AGENT"])
|
||||||
|
if (user_os == 'android'
|
||||||
|
and version_lt(user_agent['version'], android_min_app_version)):
|
||||||
return json_error("Client is too old")
|
return json_error("Client is too old")
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|||||||
Reference in New Issue
Block a user