Fix post order is no longer randomized when sorting by random (#4870).
Random posts are now returned in descending order by ID when sorting by
random, they used to be returned in a random order.
This commit is contained in:
@@ -1156,7 +1156,7 @@ class Post < ApplicationRecord
|
|||||||
random_up(key) || random_down(key)
|
random_up(key) || random_down(key)
|
||||||
end.compact.uniq
|
end.compact.uniq
|
||||||
|
|
||||||
find_ordered(posts.map(&:id))
|
reorder(nil).find_ordered(posts.map(&:id))
|
||||||
end
|
end
|
||||||
|
|
||||||
def random_up(key)
|
def random_up(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user