mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	openapi: Pass required arguments to select_related call.
This commit adds code to pass all the required arguments to select_related call for Message objects such that only the required related fields are fetched from the database. Previously, we did not pass any arguments to select_related, so all the directly and indirectly related fields were fetched when many of them were actually not being used and made the query unnecessarily complex.
This commit is contained in:
		@@ -131,7 +131,7 @@ def add_emoji_to_message() -> Dict[str, object]:
 | 
			
		||||
    emoji_code = "1f419"
 | 
			
		||||
    reaction_type = "unicode_emoji"
 | 
			
		||||
 | 
			
		||||
    message = Message.objects.select_related().get(id=message_id)
 | 
			
		||||
    message = Message.objects.select_related(*Message.DEFAULT_SELECT_RELATED).get(id=message_id)
 | 
			
		||||
    do_add_reaction(user_profile, message, emoji_name, emoji_code, reaction_type)
 | 
			
		||||
 | 
			
		||||
    return {}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user