mirror of https://github.com/zulip/zulip.git
streams: Fix bug that allows 0 value for message_retention_days.
This commit is contained in:
parent
72dd5bfa77
commit
7b3f4755ff
|
@ -938,6 +938,10 @@ class StreamAdminTest(ZulipTestCase):
|
|||
{'message_retention_days': ujson.dumps(-1)})
|
||||
self.assert_json_error(result, "Bad value for 'message_retention_days': -1")
|
||||
|
||||
result = self.client_patch(f'/json/streams/{stream.id}',
|
||||
{'message_retention_days': ujson.dumps(0)})
|
||||
self.assert_json_error(result, "Bad value for 'message_retention_days': 0")
|
||||
|
||||
def test_change_stream_message_retention_days_requires_realm_owner(self) -> None:
|
||||
user_profile = self.example_user('iago')
|
||||
self.login_user(user_profile)
|
||||
|
|
|
@ -134,7 +134,7 @@ def parse_message_retention_days(value: Union[int, str]) -> Optional[int]:
|
|||
return -1
|
||||
if value == "realm_default":
|
||||
return None
|
||||
if isinstance(value, str) or value < 0:
|
||||
if isinstance(value, str) or value <= 0:
|
||||
raise RequestVariableConversionError('message_retention_days', value)
|
||||
assert isinstance(value, int)
|
||||
return value
|
||||
|
|
Loading…
Reference in New Issue