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.

email_senders: Handle a None realm_id.

Alex Vandiver198a5a8294fe
diff --git a/zerver/worker/email_senders_base.py b/zerver/worker/email_senders_base.py
index c5465048297..3e61feb0af4 100644
--- a/zerver/worker/email_senders_base.py
+++ b/zerver/worker/email_senders_base.py
@@ -64,9 +64,10 @@ class EmailSendingWorker(LoopQueueProcessingWorker):
if "failed_tries" in copied_event:
del copied_event["failed_tries"]
handle_send_email_format_changes(copied_event)
- if copied_event.get("realm_id") is not None:
+ if "realm_id" in copied_event:
# "realm" does not serialize over the queue, so we send the realm_id
- copied_event["realm"] = Realm.objects.get(id=copied_event["realm_id"])
+ if copied_event.get("realm_id") is not None:
+ copied_event["realm"] = Realm.objects.get(id=copied_event["realm_id"])
del copied_event["realm_id"]
self.connection = initialize_connection(self.connection)
send_immediate_email(**copied_event, connection=self.connection)