mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
message: Do not pass "sender__realm" to select_related.
We have modified the code to directly fetch realm from Message object instead of "sender" field and thus we no longer need to fetch "sender__realm" using select_related.
This commit is contained in:
@@ -598,7 +598,7 @@ class MessageDict:
|
|||||||
# of going to the DB here should be overshadowed by the cost of rendering
|
# of going to the DB here should be overshadowed by the cost of rendering
|
||||||
# and updating the row.
|
# and updating the row.
|
||||||
# TODO: see #1379 to eliminate Markdown dependencies
|
# TODO: see #1379 to eliminate Markdown dependencies
|
||||||
message = Message.objects.select_related("sender", "sender__realm").get(id=message_id)
|
message = Message.objects.select_related("sender").get(id=message_id)
|
||||||
|
|
||||||
assert message is not None # Hint for mypy.
|
assert message is not None # Hint for mypy.
|
||||||
# It's unfortunate that we need to have side effects on the message
|
# It's unfortunate that we need to have side effects on the message
|
||||||
|
|||||||
@@ -2989,7 +2989,7 @@ class Message(AbstractMessage):
|
|||||||
|
|
||||||
search_tsvector = SearchVectorField(null=True)
|
search_tsvector = SearchVectorField(null=True)
|
||||||
|
|
||||||
DEFAULT_SELECT_RELATED = ["sender", "sender__realm", "realm", "recipient", "sending_client"]
|
DEFAULT_SELECT_RELATED = ["sender", "realm", "recipient", "sending_client"]
|
||||||
|
|
||||||
def topic_name(self) -> str:
|
def topic_name(self) -> str:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user