mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 02:11:30 +08:00
PERF: Rely on preload for first_post for TopicBookmarkable (#18066)
In 49a70a37f10edb05fd98ac9935f72aeb00a842d2 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…
x
Reference in New Issue
Block a user