mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	message_send: Fix old guests being treated as full members.
For streams in which only full members are allowed to post, we block guest users from posting there. Guests users were blocked from posting to admin only streams already. So now, guest users can only post to STREAM_POST_POLICY_EVERYONE streams. This is not a new feature but a bugfix which should have happened when implementing full member stream policy / guest users.
This commit is contained in:
		@@ -194,6 +194,10 @@ class MessagePOSTTest(ZulipTestCase):
 | 
			
		||||
                                     'Test topic', 'Test message by notification bot')
 | 
			
		||||
        self.assertEqual(self.get_last_message().content, 'Test message by notification bot')
 | 
			
		||||
 | 
			
		||||
        guest_profile = self.example_user("polonius")
 | 
			
		||||
        # Guests cannot send to non-STREAM_POST_POLICY_EVERYONE streams
 | 
			
		||||
        self._send_and_verify_message(guest_profile, stream_name, "Only organization administrators can send to this stream.")
 | 
			
		||||
 | 
			
		||||
    def test_sending_message_as_stream_post_policy_restrict_new_members(self) -> None:
 | 
			
		||||
        """
 | 
			
		||||
        Sending messages to streams which new members cannot create and post to.
 | 
			
		||||
@@ -258,6 +262,10 @@ class MessagePOSTTest(ZulipTestCase):
 | 
			
		||||
                                     'Test topic', 'Test message by notification bot')
 | 
			
		||||
        self.assertEqual(self.get_last_message().content, 'Test message by notification bot')
 | 
			
		||||
 | 
			
		||||
        guest_profile = self.example_user("polonius")
 | 
			
		||||
        # Guests cannot send to non-STREAM_POST_POLICY_EVERYONE streams
 | 
			
		||||
        self._send_and_verify_message(guest_profile, stream_name, "Guests cannot send to this stream.")
 | 
			
		||||
 | 
			
		||||
    def test_api_message_with_default_to(self) -> None:
 | 
			
		||||
        """
 | 
			
		||||
        Sending messages without a to field should be sent to the default
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user