Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
events: Send invites_changed event if user deactivation revokes invites.
Mateusz Manderaf8b06ed95228
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 835e51aa524..c08d48d464b 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -7628,6 +7628,8 @@ def revoke_invites_generated_by_user(user_profile: UserProfile) -> None:confirmation.expiry_date = nowConfirmation.objects.bulk_update(confirmations_to_revoke, ["expiry_date"])+ if len(confirmations_to_revoke):+ notify_invites_changed(realm=user_profile.realm)def do_create_multiuse_invite_link(diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex c79a405b1e0..863707eda65 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -744,7 +744,25 @@ class NormalActionsTest(BaseAction):)check_invites_changed("events[0]", events[0])+ def test_deactivate_user_invites_changed_event(self) -> None:+ self.user_profile = self.example_user("iago")+ user_profile = self.example_user("cordelia")+ invite_expires_in_days = 2+ do_invite_users(+ user_profile,+ ["[email protected]"],+ [],+ invite_expires_in_days=invite_expires_in_days,+ )++ events = self.verify_action(+ lambda: do_deactivate_user(user_profile, acting_user=None), num_events=2+ )+ check_invites_changed("events[0]", events[0])+def test_revoke_user_invite_event(self) -> None:+ # We need set self.user_profile to be an admin, so that+ # we receive the invites_changed event.self.user_profile = self.example_user("iago")streams = []for stream_name in ["Denmark", "Verona"]: