mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Don't pluck all the columns just to retrieve a single value.
This commit is contained in:
@@ -186,10 +186,8 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
end
|
||||
|
||||
def last_read_post_id
|
||||
return nil unless object.filtered_post_stream && last_read_post_number
|
||||
object.filtered_post_stream.each do |ps|
|
||||
return ps[0] if ps[1] === last_read_post_number
|
||||
end
|
||||
return nil unless last_read_post_number
|
||||
object.last_read_post_id(last_read_post_number)
|
||||
end
|
||||
alias_method :include_last_read_post_id?, :has_topic_user?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user