diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index b78e62f6aa..e2b50c0ee1 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1546,12 +1546,6 @@ def check_message(sender, client, addressee, if addressee.is_stream(): stream_name = addressee.stream_name() - if stream_name is None: - if sender.default_sending_stream: - # Use the users default stream - stream_name = sender.default_sending_stream.name - else: - raise JsonableError(_('Missing stream')) stream_name = stream_name.strip() check_stream_name(stream_name) diff --git a/zerver/lib/addressee.py b/zerver/lib/addressee.py index 9a9b3da521..5da1dcad41 100644 --- a/zerver/lib/addressee.py +++ b/zerver/lib/addressee.py @@ -97,7 +97,11 @@ class Addressee(object): # This is a hack to deal with the fact that we still support # default streams (and the None will be converted later in the # callpath). - stream_name = None + if sender.default_sending_stream: + # Use the users default stream + stream_name = sender.default_sending_stream.name + else: + raise JsonableError(_('Missing stream')) return Addressee.for_stream(stream_name, topic_name) elif message_type_name == 'private':