Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
users: Send peer_remove for archived streams as well on deactivation.
Shubham Padia3057f4bc6d2b
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 62a09ceb24d..4d9477dd5e6 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 12.0+**Feature level 428**++* [`GET /events`](/api/get-events): When a user is deactivated,+ `peer_remove` events are now sent for archived streams as well,+ not just unarchived ones.+**Feature level 427*** [`POST /register`](/api/register-queue): `stream_creator_or_nobody`diff --git a/version.py b/version.pyindex a8c85dcfcc4..b64b2dba78c 100644--- a/version.py+++ b/version.py@@ -35,7 +35,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 427+API_FEATURE_LEVEL = 428# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/actions/users.py b/zerver/actions/users.pyindex 34904aa5b5e..4c9d5ed1eb2 100644--- a/zerver/actions/users.py+++ b/zerver/actions/users.py@@ -387,6 +387,7 @@ def send_events_for_user_deactivation(user_profile: UserProfile) -> None:user_profile,include_public=False,include_subscribed=True,+ exclude_archived=False,)altered_user_dict: dict[int, set[int]] = defaultdict(set)streams: list[Stream] = []diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 9bee5a097c9..5bccb714cf3 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -923,11 +923,15 @@ paths:removing the user's subscriptions before the `realm_user` eventfor the user's deactivation.+ **Changes**: Before Zulip 12.0 (feature level 428), this event+ was incorrectly not sent when deactivating a user subscribed to+ archived channels. Clients supporting older server versions and+ maintaining peer subscriber data need to remove all channel+ subscriptions for a user when processing the `realm_user` event+ with `op="remove"`.+**Changes**: Before Zulip 10.0 (feature level 377), this event- was not sent on user deactivation. Clients supporting older- server versions and maintaining peer subscriber data need to- remove all channel subscriptions for a user when processing the- `realm_user` event with `op="remove"`.+ was not sent on user deactivation.**Changes**: New in Zulip 4.0 (feature level 35), replacingthe `stream_id` integer.diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 0ddab921a53..ab4ea075944 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -3636,6 +3636,17 @@ class NormalActionsTest(BaseAction):check_subscription_peer_remove("events[0]", events[0])check_realm_user_update("events[1]", events[1], "is_active")+ # Send peer_remove events for archived streams.+ do_reactivate_user(user_profile, acting_user=None)+ stream = self.make_stream("Stream to be archived")+ self.subscribe(user_profile, "Stream to be archived")+ do_deactivate_stream(stream, acting_user=None)+ with self.verify_action(num_events=2) as events:+ do_deactivate_user(user_profile, acting_user=None)+ self.assertIn(stream.id, events[0]["stream_ids"])+ check_subscription_peer_remove("events[0]", events[0])+ check_realm_user_update("events[1]", events[1], "is_active")+do_reactivate_user(user_profile, acting_user=None)# Test that guest users receive 'user_group/remove_members'