mirror of https://github.com/zulip/zulip.git
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:
parent
7ff5423e21
commit
a6df377688
|
@ -131,7 +131,7 @@ def add_emoji_to_message() -> Dict[str, object]:
|
||||||
emoji_code = "1f419"
|
emoji_code = "1f419"
|
||||||
reaction_type = "unicode_emoji"
|
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)
|
do_add_reaction(user_profile, message, emoji_name, emoji_code, reaction_type)
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Reference in New Issue