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: Add a large block comment on correctness.

Tim Abbott5a02b33f2ea4
diff --git a/zerver/lib/digest.py b/zerver/lib/digest.py
index 95a3fdaf320..49958471a36 100644
--- a/zerver/lib/digest.py
+++ b/zerver/lib/digest.py
@@ -372,6 +372,18 @@ def bulk_write_realm_audit_logs(users: List[UserProfile]) -> None:
RealmAuditLog.objects.bulk_create(log_rows)
def get_modified_streams(user_ids: List[int], cutoff_date: datetime.datetime) -> Dict[int, Set[int]]:
+ """Skipping streams where the user's subscription status has changed
+ when constructing digests is critical to ensure correctness for
+ streams without shared history, guest users, and long-term idle
+ users, because it means that every user has the same view of the
+ history of a given stream whose message history is being included
+ (and thus we can share a lot of work).
+
+ The downside is that newly created streams are never included in
+ the first digest email after their creation. Should we wish to
+ change that, we will need to be very careful to avoid creating
+ bugs for any of those classes of users.
+ """
events = [
RealmAuditLog.SUBSCRIPTION_CREATED,
RealmAuditLog.SUBSCRIPTION_ACTIVATED,