mirror of https://github.com/zulip/zulip.git
events: Send invites_changed event if user deactivation revokes invites.
revoke_invites_generated_by_user should send invites_changed event if it actually revokes some invitations. This is called in the user deactivatoin codepath.
This commit is contained in:
parent
74d2aea76a
commit
f8b06ed952
|
@ -7628,6 +7628,8 @@ def revoke_invites_generated_by_user(user_profile: UserProfile) -> None:
|
||||||
confirmation.expiry_date = now
|
confirmation.expiry_date = now
|
||||||
|
|
||||||
Confirmation.objects.bulk_update(confirmations_to_revoke, ["expiry_date"])
|
Confirmation.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(
|
def do_create_multiuse_invite_link(
|
||||||
|
|
|
@ -744,7 +744,25 @@ class NormalActionsTest(BaseAction):
|
||||||
)
|
)
|
||||||
check_invites_changed("events[0]", events[0])
|
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,
|
||||||
|
["foo@zulip.com"],
|
||||||
|
[],
|
||||||
|
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:
|
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")
|
self.user_profile = self.example_user("iago")
|
||||||
streams = []
|
streams = []
|
||||||
for stream_name in ["Denmark", "Verona"]:
|
for stream_name in ["Denmark", "Verona"]:
|
||||||
|
|
Loading…
Reference in New Issue