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.

digest: Pass length of hot_conversations to enough_traffic function.

opmkumarec81c027fcff
diff --git a/zerver/lib/digest.py b/zerver/lib/digest.py
index 20ee0fc7bcd..c46a5b008fb 100644
--- a/zerver/lib/digest.py
+++ b/zerver/lib/digest.py
@@ -268,7 +268,7 @@ def gather_new_streams(
return len(new_streams), {"html": channels_html, "plain": channels_plain}
-def enough_traffic(hot_conversations: str, new_streams: int) -> bool:
+def enough_traffic(hot_conversations: int, new_streams: int) -> bool:
return bool(hot_conversations or new_streams)
@@ -400,7 +400,7 @@ def bulk_handle_digest_email(user_ids: list[int], cutoff: float) -> None:
for user, context in bulk_get_digest_context(users, cutoff):
# We don't want to send emails containing almost no information.
- if not enough_traffic(context["hot_conversations"], context["new_streams_count"]):
+ if not enough_traffic(len(context["hot_conversations"]), context["new_streams_count"]):
continue
digest_users.append(user)
diff --git a/zerver/tests/test_digest.py b/zerver/tests/test_digest.py
index a48a3261e5e..507f30db65b 100644
--- a/zerver/tests/test_digest.py
+++ b/zerver/tests/test_digest.py
@@ -144,7 +144,7 @@ class TestDigestEmailMessages(ZulipTestCase):
) as enough_traffic_mock:
bulk_handle_digest_email([othello.id], in_the_future)
mock_send_future_email.assert_called()
- enough_traffic_mock.assert_called_once_with([], 0)
+ enough_traffic_mock.assert_called_once_with(0, 0)
@mock.patch("zerver.lib.digest.enough_traffic")
@mock.patch("zerver.lib.digest.send_future_email")