mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	subs: Fix subscriber_..._history_access to not exclude subbed guests.
Guests are supposed to have stream history access to public streams they're subscribed to.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							68d1f2d7ef
						
					
				
				
					commit
					ccfcc186ad
				
			@@ -260,24 +260,19 @@ def subscriber_ids_with_stream_history_access(stream: Stream) -> Set[int]:
 | 
			
		||||
 | 
			
		||||
    1. if !history_public_to_subscribers:
 | 
			
		||||
          History is not available to anyone
 | 
			
		||||
    2. if history_public_to_subscribers and is_web_public:
 | 
			
		||||
    2. if history_public_to_subscribers:
 | 
			
		||||
          All subscribers can access the history including guests
 | 
			
		||||
    3. if history_public_to_subscribers and !is_web_public:
 | 
			
		||||
          All subscribers can access the history excluding guests
 | 
			
		||||
 | 
			
		||||
    The results of this function need to be kept consistent with
 | 
			
		||||
    what can_access_stream_history would dictate.
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    if not stream.is_history_public_to_subscribers():
 | 
			
		||||
        return set()
 | 
			
		||||
 | 
			
		||||
    subscriptions = get_active_subscriptions_for_stream_id(
 | 
			
		||||
        stream.id, include_deactivated_users=False
 | 
			
		||||
    )
 | 
			
		||||
    if stream.is_web_public:
 | 
			
		||||
        return set(subscriptions.values_list("user_profile__id", flat=True))
 | 
			
		||||
 | 
			
		||||
    return set(
 | 
			
		||||
        subscriptions.exclude(user_profile__role=UserProfile.ROLE_GUEST).values_list(
 | 
			
		||||
            "user_profile__id", flat=True
 | 
			
		||||
        )
 | 
			
		||||
        get_active_subscriptions_for_stream_id(
 | 
			
		||||
            stream.id, include_deactivated_users=False
 | 
			
		||||
        ).values_list("user_profile__id", flat=True)
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user