mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	apply_events: Update state["subscribers"] upon "remove user" event.
Event of type "realm_user", op "remove", emitted by do_deactivate_user should remove the user id from subscriptions in the state. We weren't catching this bug, because test_do_deactivate_bot uses a newly created bot, so no stream subscriptions are affected. The bug shows up if deactivating e.g. cordelia - thus we want to have two tests instead, one for testing bot deactivation and one for user deactivation.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							dd1c9c45c7
						
					
				
				
					commit
					74d2aea76a
				
			@@ -746,6 +746,11 @@ def apply_event(
 | 
			
		||||
            state["raw_users"][person_user_id] = person
 | 
			
		||||
        elif event["op"] == "remove":
 | 
			
		||||
            state["raw_users"][person_user_id]["is_active"] = False
 | 
			
		||||
            if include_subscribers:
 | 
			
		||||
                for sub in state["subscriptions"]:
 | 
			
		||||
                    sub["subscribers"] = [
 | 
			
		||||
                        user_id for user_id in sub["subscribers"] if user_id != person_user_id
 | 
			
		||||
                    ]
 | 
			
		||||
        elif event["op"] == "update":
 | 
			
		||||
            is_me = person_user_id == user_profile.id
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user