streams: Fix events send when archiving and unarchiving streams.

(cherry picked from commit 7c470f0161)
This commit is contained in:
Sahil Batra
2025-03-31 12:31:30 +05:30
committed by Tim Abbott
parent 43c6e3d47f
commit 53f885fa15
9 changed files with 317 additions and 112 deletions

View File

@@ -148,11 +148,13 @@ def send_stream_creation_event(
user_ids: list[int],
recent_traffic: dict[int, int] | None = None,
anonymous_group_membership: dict[int, UserGroupMembersData] | None = None,
for_unarchiving: bool = False,
) -> None:
event = dict(
type="stream",
op="create",
streams=[stream_to_dict(stream, recent_traffic, anonymous_group_membership)],
for_unarchiving=for_unarchiving,
)
send_event_on_commit(realm, event, user_ids)
@@ -1753,7 +1755,7 @@ def check_update_all_streams_active_status(
def send_stream_deletion_event(
realm: Realm, user_ids: Iterable[int], streams: list[Stream]
realm: Realm, user_ids: Iterable[int], streams: list[Stream], for_archiving: bool = False
) -> None:
stream_deletion_event = dict(
type="stream",
@@ -1761,6 +1763,7 @@ def send_stream_deletion_event(
# "streams" is deprecated, kept only for compatibility.
streams=[dict(stream_id=stream.id) for stream in streams],
stream_ids=[stream.id for stream in streams],
for_archiving=for_archiving,
)
send_event_on_commit(realm, stream_deletion_event, user_ids)