From eb62693d267762e50ddafd040d8b042232d44a44 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 21 Sep 2021 11:05:59 -0700 Subject: [PATCH] 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. --- zerver/lib/streams.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py index b4a89d5faf..238c1c5d5c 100644 --- a/zerver/lib/streams.py +++ b/zerver/lib/streams.py @@ -665,13 +665,15 @@ def list_to_streams( # Guest users case will not be handled here as it will be # handled by the decorator in add_subscriptions_backend. raise JsonableError(_("Insufficient permission")) - elif not autocreate: + + if not autocreate: raise JsonableError( _("Stream(s) ({}) do not exist").format( ", ".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: raise OrganizationOwnerRequired()