mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 00:23:49 +00:00
users: Fetch user groups ordered by ID to send events.
The user groups, fetched to send events when deactivating or reactivating a user, are ordered by ID so that we can avoid flaky behavior in tests when verifying event details in test_do_deactivate_user and test_do_reactivate_user tests in test_events.py.
This commit is contained in:
@@ -776,7 +776,9 @@ def do_reactivate_user(user_profile: UserProfile, *, acting_user: UserProfile |
|
|||||||
subscriber_peer_info=subscriber_peer_info,
|
subscriber_peer_info=subscriber_peer_info,
|
||||||
)
|
)
|
||||||
|
|
||||||
member_user_groups = user_profile.direct_groups.select_related("named_user_group")
|
member_user_groups = user_profile.direct_groups.select_related("named_user_group").order_by(
|
||||||
|
"id"
|
||||||
|
)
|
||||||
named_user_groups = []
|
named_user_groups = []
|
||||||
setting_user_groups = []
|
setting_user_groups = []
|
||||||
for group in member_user_groups:
|
for group in member_user_groups:
|
||||||
|
|||||||
@@ -427,7 +427,9 @@ def send_events_for_user_deactivation(user_profile: UserProfile) -> None:
|
|||||||
# data, but guests who cannot access the deactivated user
|
# data, but guests who cannot access the deactivated user
|
||||||
# need an explicit 'user_group/remove_members' event to
|
# need an explicit 'user_group/remove_members' event to
|
||||||
# update the user groups data.
|
# update the user groups data.
|
||||||
deactivated_user_groups = user_profile.direct_groups.select_related("named_user_group")
|
deactivated_user_groups = user_profile.direct_groups.select_related(
|
||||||
|
"named_user_group"
|
||||||
|
).order_by("id")
|
||||||
deactivated_user_named_groups = []
|
deactivated_user_named_groups = []
|
||||||
deactivated_user_setting_groups = []
|
deactivated_user_setting_groups = []
|
||||||
for group in deactivated_user_groups:
|
for group in deactivated_user_groups:
|
||||||
|
|||||||
Reference in New Issue
Block a user