mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
internal_prep_message: Don't call ensure_stream for stream IDs.
Ever since we implemented support for stream IDs in Addressee, Addressee.stream_name() can now return None. This commit ensures that _internal_prep_message only calls ensure_stream when Addressee.stream_name() is not None.
This commit is contained in:
@@ -2280,7 +2280,12 @@ def _internal_prep_message(realm: Realm,
|
||||
if realm is None:
|
||||
raise RuntimeError("None is not a valid realm for internal_prep_message!")
|
||||
|
||||
if addressee.is_stream():
|
||||
# If we have a stream name, and the stream doesn't exist, we
|
||||
# create it here (though this code path should probably be removed
|
||||
# eventually, moving that responsibility to the caller). If
|
||||
# addressee.stream_name() is None (i.e. we're sending to a stream
|
||||
# by ID), we skip this, as the stream object must already exist.
|
||||
if addressee.is_stream() and addressee.stream_name() is not None:
|
||||
ensure_stream(realm, addressee.stream_name())
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user