mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
Remove untested code in is_public_stream().
We were calling valid_stream_name(), but more appropriate validation checks for stream names happen elsewhere in the codepath.
This commit is contained in:
@@ -29,7 +29,7 @@ from zerver.lib.validator import \
|
|||||||
check_list, check_int, check_dict, check_string, check_bool
|
check_list, check_int, check_dict, check_string, check_bool
|
||||||
from zerver.models import Message, UserProfile, Stream, Subscription, \
|
from zerver.models import Message, UserProfile, Stream, Subscription, \
|
||||||
Recipient, UserMessage, bulk_get_recipients, get_recipient, \
|
Recipient, UserMessage, bulk_get_recipients, get_recipient, \
|
||||||
get_user_profile_by_email, get_stream, valid_stream_name, \
|
get_user_profile_by_email, get_stream, \
|
||||||
parse_usermessage_flags, to_dict_cache_key_id, extract_message_dict, \
|
parse_usermessage_flags, to_dict_cache_key_id, extract_message_dict, \
|
||||||
stringify_message_dict, \
|
stringify_message_dict, \
|
||||||
resolve_email_to_domain, get_realm, get_active_streams, \
|
resolve_email_to_domain, get_realm, get_active_streams, \
|
||||||
@@ -322,8 +322,16 @@ def narrow_parameter(json):
|
|||||||
return list(map(convert_term, data))
|
return list(map(convert_term, data))
|
||||||
|
|
||||||
def is_public_stream(stream, realm):
|
def is_public_stream(stream, realm):
|
||||||
if not valid_stream_name(stream):
|
"""
|
||||||
raise JsonableError(_("Invalid stream name"))
|
Determine whether a stream is public, so that
|
||||||
|
our caller can decide whether we can get
|
||||||
|
historical messages for a narrowing search.
|
||||||
|
|
||||||
|
Because of the way our search is currently structured,
|
||||||
|
we may be passed an invalid stream here. We return
|
||||||
|
False in that situation, and subsequent code will do
|
||||||
|
validation and raise the appropriate JsonableError.
|
||||||
|
"""
|
||||||
stream = get_stream(stream, realm)
|
stream = get_stream(stream, realm)
|
||||||
if stream is None:
|
if stream is None:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user