list_to_streams: Use simpler if statement flow.

Since each if statement just raises an exception if triggered,
removing the else blocks makes the logic more readable.
This commit is contained in:
Tim Abbott 2021-09-21 11:05:59 -07:00
parent 71b8a1794a
commit eb62693d26
1 changed files with 4 additions and 2 deletions

View File

@ -665,13 +665,15 @@ def list_to_streams(
# Guest users case will not be handled here as it will be # Guest users case will not be handled here as it will be
# handled by the decorator in add_subscriptions_backend. # handled by the decorator in add_subscriptions_backend.
raise JsonableError(_("Insufficient permission")) raise JsonableError(_("Insufficient permission"))
elif not autocreate:
if not autocreate:
raise JsonableError( raise JsonableError(
_("Stream(s) ({}) do not exist").format( _("Stream(s) ({}) do not exist").format(
", ".join(stream_dict["name"] for stream_dict in missing_stream_dicts), ", ".join(stream_dict["name"] for stream_dict in missing_stream_dicts),
) )
) )
elif message_retention_days_not_none:
if message_retention_days_not_none:
if not user_profile.is_realm_owner: if not user_profile.is_realm_owner:
raise OrganizationOwnerRequired() raise OrganizationOwnerRequired()