Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

add_new_realm: Fix strict_optional errors.

Anders Kaseorg6c9c12ee2d7d
diff --git a/mypy.ini b/mypy.ini
index 8cd9faf88ee..fc45dce219b 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -38,11 +38,6 @@ warn_unreachable = True
strict_optional = True
-# One change required?
-
-[mypy-zilencer.management.commands.add_new_realm] #22: error: List item 0 has incompatible type "Optional[Stream]"; expected "Stream"
-strict_optional = False
-
# Re-architecting required?
[mypy-zerver.lib.queue] # Delayed setup of SimpleQueueClient.channel (Optional)
diff --git a/zilencer/management/commands/add_new_realm.py b/zilencer/management/commands/add_new_realm.py
index 3a6268fee3f..215e42cabf9 100644
--- a/zilencer/management/commands/add_new_realm.py
+++ b/zilencer/management/commands/add_new_realm.py
@@ -18,6 +18,7 @@ class Command(ZulipBaseCommand):
UserProfile.objects.filter(email__contains='user@').count())
user = do_create_user(f'{name}@{string_id}.zulip.com',
'password', realm, name, name, role=UserProfile.ROLE_REALM_ADMINISTRATOR)
+ assert realm.signup_notifications_stream is not None
bulk_add_subscriptions([realm.signup_notifications_stream], [user])
send_initial_realm_messages(realm)