mirror of https://github.com/zulip/zulip.git
Handle negated streams in ok_to_include_history.
(imported from commit 0a049364e1d14f45db9f8e9aa5392039a01231eb)
This commit is contained in:
parent
11ba6a17ab
commit
fb27cbcd01
|
@ -38,6 +38,12 @@ class IncludeHistoryTest(AuthedTestCase):
|
|||
realm = get_realm('zulip.com')
|
||||
create_stream_if_needed(realm, 'public_stream')
|
||||
|
||||
# Negated stream searches should not include history.
|
||||
narrow = [
|
||||
dict(operator='stream', operand='public_stream', negated=True),
|
||||
]
|
||||
self.assertFalse(ok_to_include_history(narrow, realm))
|
||||
|
||||
# Definitely forbid seeing history on private streams.
|
||||
narrow = [
|
||||
dict(operator='stream', operand='private_stream'),
|
||||
|
|
|
@ -349,7 +349,7 @@ def ok_to_include_history(narrow, realm):
|
|||
include_history = False
|
||||
if narrow is not None:
|
||||
for term in narrow:
|
||||
if term['operator'] == "stream":
|
||||
if term['operator'] == "stream" and not term.get('negated', False):
|
||||
if is_public_stream(term['operand'], realm):
|
||||
include_history = True
|
||||
# Disable historical messages if the user is narrowing on anything
|
||||
|
|
Loading…
Reference in New Issue