api: Make update_user_by_id compatible.
				
					
				
			As part of supporting the change in zulip/zulip#18409, we add a conditional to send the old/buggy format only to servers with feature levels indicating they don't support the modern version.
This commit is contained in:
		
							parent
							
								
									c6b6a82d90
								
							
						
					
					
						commit
						c59b143d96
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1308,8 +1308,11 @@ class Client:
 | 
			
		|||
        {'result': 'success', 'msg': ''}
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        for key, value in request.items():
 | 
			
		||||
            request[key] = json.dumps(value)
 | 
			
		||||
        if "full_name" in request and self.feature_level < 106:
 | 
			
		||||
            # As noted in https://github.com/zulip/zulip/issues/18409,
 | 
			
		||||
            # before feature level 106, the server expected a
 | 
			
		||||
            # buggy double JSON encoding of the `full_name` parameter.
 | 
			
		||||
            request["full_name"] = json.dumps(request["full_name"])
 | 
			
		||||
 | 
			
		||||
        return self.call_endpoint(url=f"users/{user_id}", method="PATCH", request=request)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue