mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
PERF: Rely on preload for first_post for TopicBookmarkable (#18066)
In 49a70a37f1
I removed the
topic: :posts preload for TopicBookmarkable, but did not
update the UserTopicBookmarkSerializer to reflect this,
which was causing up to multi-hundred millisecond queries to
be made for each topic bookmark based on the size of the
topic.
This commit is contained in:
parent
7a58bd8827
commit
4b84236bc1
@ -11,7 +11,7 @@ class UserTopicBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
|
||||
end
|
||||
|
||||
def first_post
|
||||
@first_post ||= topic.posts.find { |post| post.post_number == 1 }
|
||||
@first_post ||= topic.first_post
|
||||
end
|
||||
|
||||
def deleted
|
||||
|
Loading…
Reference in New Issue
Block a user