mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	user_groups: Update delete_user_group codepath to send event on commit.
Earlier, we were using 'send_event' in 'delete_user_grou' codepath which can lead to a situation, if any db operation is added after the 'send_event' in future, where we enqueue events but the function fails at a later stage. Events should not be sent until we know we're not rolling back. Fixes part of #30489.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							66ff646e99
						
					
				
				
					commit
					427c59ec68
				
			@@ -425,7 +425,7 @@ def remove_subgroups_from_user_group(
 | 
			
		||||
 | 
			
		||||
def do_send_delete_user_group_event(realm: Realm, user_group_id: int, realm_id: int) -> None:
 | 
			
		||||
    event = dict(type="user_group", op="remove", group_id=user_group_id)
 | 
			
		||||
    send_event(realm, event, active_user_ids(realm_id))
 | 
			
		||||
    send_event_on_commit(realm, event, active_user_ids(realm_id))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_delete_user_group(user_group: NamedUserGroup, *, acting_user: UserProfile) -> None:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user