mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	api: Allow setting email_notifications_batching_period_seconds.
We allow a maximum value of one week to make sure there aren't a huge number of rows in the table for any user (this could happen if stream notifications are enabled). This commit also fixes a small error in the user_settings test.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							dd5e12d112
						
					
				
				
					commit
					5db4fe8652
				
			@@ -121,6 +121,9 @@ def json_change_settings(
 | 
			
		||||
    timezone: Optional[str] = REQ(
 | 
			
		||||
        str_validator=check_string_in(pytz.all_timezones_set), default=None
 | 
			
		||||
    ),
 | 
			
		||||
    email_notifications_batching_period_seconds: Optional[int] = REQ(
 | 
			
		||||
        json_validator=check_int, default=None
 | 
			
		||||
    ),
 | 
			
		||||
    enable_stream_desktop_notifications: Optional[bool] = REQ(
 | 
			
		||||
        json_validator=check_bool, default=None
 | 
			
		||||
    ),
 | 
			
		||||
@@ -169,6 +172,17 @@ def json_change_settings(
 | 
			
		||||
    ):
 | 
			
		||||
        raise JsonableError(_("Invalid notification sound '{}'").format(notification_sound))
 | 
			
		||||
 | 
			
		||||
    if email_notifications_batching_period_seconds is not None and (
 | 
			
		||||
        email_notifications_batching_period_seconds <= 0
 | 
			
		||||
        or email_notifications_batching_period_seconds > 7 * 24 * 60 * 60
 | 
			
		||||
    ):
 | 
			
		||||
        # We set a limit of one week for the batching period
 | 
			
		||||
        raise JsonableError(
 | 
			
		||||
            _("Invalid email batching period: {} seconds").format(
 | 
			
		||||
                email_notifications_batching_period_seconds
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    if new_password != "":
 | 
			
		||||
        return_data: Dict[str, Any] = {}
 | 
			
		||||
        if email_belongs_to_ldap(user_profile.realm, user_profile.delivery_email):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user