mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
user_groups: Do not include deactivated users in members list.
This commit updates code to not include deactivated users in
members list in the user groups object sent in "/register"
and "GET /user_groups" response and also in the response
returned by endpoint like "GET /user_groups/{group_id}/members".
The events code is also update to handle this -
- We expect clients to update the members list on receiving
"realm_user/update" event on deactivation. But for guests
who cannot access the user, "user_group/remove_members"
event is sent to update the group members list on deactivation.
- "user_group/add_members" event is sent to all the users on
reactivating the user.
This commit is contained in:
@@ -771,3 +771,11 @@ def do_reactivate_user(user_profile: UserProfile, *, acting_user: UserProfile |
|
||||
stream_dict=stream_dict,
|
||||
subscriber_peer_info=subscriber_peer_info,
|
||||
)
|
||||
|
||||
member_user_groups = user_profile.direct_groups.exclude(named_user_group=None).select_related(
|
||||
"named_user_group"
|
||||
)
|
||||
for user_group in member_user_groups:
|
||||
do_send_user_group_members_update_event(
|
||||
"add_members", user_group.named_user_group, [user_profile.id]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user