FIX: With many stickies some latest posts got missed
This commit is contained in:
parent
10460330e8
commit
fc090b4568
|
@ -208,7 +208,7 @@ class TopicQuery
|
|||
end
|
||||
|
||||
unpinned_topics = topics.where("NOT ( #{pinned_clause} )")
|
||||
pinned_topics = topics.where(pinned_clause)
|
||||
pinned_topics = topics.dup.offset(nil).where(pinned_clause)
|
||||
|
||||
per_page = options[:per_page] || per_page_setting
|
||||
limit = per_page unless options[:limit] == false
|
||||
|
@ -217,7 +217,7 @@ class TopicQuery
|
|||
if page == 0
|
||||
(pinned_topics + unpinned_topics)[0...limit] if limit
|
||||
else
|
||||
offset = (page * per_page - pinned_topics.count) - 1
|
||||
offset = (page * per_page) - pinned_topics.count - 1
|
||||
offset = 0 unless offset > 0
|
||||
unpinned_topics.offset(offset).to_a
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue