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.

minor: Move context code down in the function.

Steve Howell428f0564a07d
diff --git a/zerver/lib/digest.py b/zerver/lib/digest.py
index aa9a0774e3a..94c36898825 100644
--- a/zerver/lib/digest.py
+++ b/zerver/lib/digest.py
@@ -233,12 +233,6 @@ def bulk_get_digest_context(users: List[UserProfile], cutoff: float) -> Dict[int
stream_map = get_stream_map(user_ids)
for user in users:
- context = common_context(user)
-
- # Start building email template data.
- unsubscribe_link = one_click_unsubscribe_link(user, "digest")
- context.update(unsubscribe_link=unsubscribe_link)
-
stream_ids = stream_map[user.id]
if user.long_term_idle:
@@ -247,6 +241,12 @@ def bulk_get_digest_context(users: List[UserProfile], cutoff: float) -> Dict[int
recent_topics = get_recent_topics(sorted(list(stream_ids)), cutoff_date)
hot_topics = get_hot_topics(recent_topics)
+ context = common_context(user)
+
+ # Start building email template data.
+ unsubscribe_link = one_click_unsubscribe_link(user, "digest")
+ context.update(unsubscribe_link=unsubscribe_link)
+
# Get context data for hot conversations.
context["hot_conversations"] = [
hot_topic.teaser_data(user)