Only select required columns, and don't call excerpt twice
This commit is contained in:
parent
e20104919a
commit
8b03c459f8
10
plugin.rb
10
plugin.rb
|
@ -231,10 +231,14 @@ SQL
|
||||||
|
|
||||||
def accepted_answer_post_info
|
def accepted_answer_post_info
|
||||||
# TODO: we may already have it in the stream ... so bypass query here
|
# TODO: we may already have it in the stream ... so bypass query here
|
||||||
post = Post.where(id: accepted_answer_post_id, topic_id: object.topic.id).joins(:user).first
|
postInfo = Post.where(id: accepted_answer_post_id, topic_id: object.topic.id)
|
||||||
excerpt = post.excerpt
|
.joins(:user)
|
||||||
|
.pluck('post_number', 'username', 'cooked')
|
||||||
|
.first
|
||||||
|
|
||||||
return [post.post_number, post.username, post.excerpt(SiteSetting.solved_quote_length)]
|
postInfo[2] = PrettyText.excerpt(postInfo[2], SiteSetting.solved_quote_length)
|
||||||
|
|
||||||
|
return postInfo
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue