mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	events: Update subscriber list on peer_add for unsubscribed streams.
We update the subscriber list on peer_add event for unsubscribed streams as well.
This commit is contained in:
		@@ -719,7 +719,7 @@ def apply_event(state: Dict[str, Any],
 | 
				
			|||||||
        elif event['op'] == 'peer_add':
 | 
					        elif event['op'] == 'peer_add':
 | 
				
			||||||
            stream_ids = set(event["stream_ids"])
 | 
					            stream_ids = set(event["stream_ids"])
 | 
				
			||||||
            user_ids = set(event["user_ids"])
 | 
					            user_ids = set(event["user_ids"])
 | 
				
			||||||
            for sub_dict in [state["subscriptions"], state["never_subscribed"]]:
 | 
					            for sub_dict in [state["subscriptions"], state['unsubscribed'], state["never_subscribed"]]:
 | 
				
			||||||
                for sub in sub_dict:
 | 
					                for sub in sub_dict:
 | 
				
			||||||
                    if sub["stream_id"] in stream_ids:
 | 
					                    if sub["stream_id"] in stream_ids:
 | 
				
			||||||
                        subscribers = set(sub["subscribers"]) | user_ids
 | 
					                        subscribers = set(sub["subscribers"]) | user_ids
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1884,7 +1884,14 @@ class SubscribeActionTest(BaseAction):
 | 
				
			|||||||
            'test_stream',
 | 
					            'test_stream',
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.subscribe(self.example_user("iago"), "test_stream")
 | 
					        # Subscribe other user to test 'peer_add' event flow for unsubscribed stream.
 | 
				
			||||||
 | 
					        action = lambda: self.subscribe(self.example_user("iago"), "test_stream")
 | 
				
			||||||
 | 
					        events = self.verify_action(
 | 
				
			||||||
 | 
					            action,
 | 
				
			||||||
 | 
					            event_types=["subscription"],
 | 
				
			||||||
 | 
					            include_subscribers=include_subscribers,
 | 
				
			||||||
 | 
					            state_change_expected=include_subscribers)
 | 
				
			||||||
 | 
					        check_subscription_peer_add('events[0]', events[0])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Remove the user to test 'peer_remove' event flow for unsubscribed stream.
 | 
					        # Remove the user to test 'peer_remove' event flow for unsubscribed stream.
 | 
				
			||||||
        action = lambda: bulk_remove_subscriptions(
 | 
					        action = lambda: bulk_remove_subscriptions(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user