mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	refactor: Pass realm to bulk_add_subscriptions.
I think it's important that the callers understand that bulk_add_subscriptions assumes all streams are being created within a single realm, so I make it an explicit parameter. This may be overkill--I would also be happy if we just included the assertions from this commit.
This commit is contained in:
		@@ -28,7 +28,7 @@ class Command(ZulipBaseCommand):
 | 
			
		||||
        for stream_name in set(stream_names):
 | 
			
		||||
            for user_profile in user_profiles:
 | 
			
		||||
                stream = ensure_stream(realm, stream_name, acting_user=None)
 | 
			
		||||
                _ignore, already_subscribed = bulk_add_subscriptions([stream], [user_profile])
 | 
			
		||||
                _ignore, already_subscribed = bulk_add_subscriptions(realm, [stream], [user_profile])
 | 
			
		||||
                was_there_already = user_profile.id in (tup[0].id for tup in already_subscribed)
 | 
			
		||||
                print("{} {} to {}".format(
 | 
			
		||||
                    "Already subscribed" if was_there_already else "Subscribed",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user