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:
evazion
2021-09-01 22:31:41 -05:00
parent f198a52f9e
commit 80bf54205c

View File

@@ -1156,7 +1156,7 @@ class Post < ApplicationRecord
random_up(key) || random_down(key)
end.compact.uniq
find_ordered(posts.map(&:id))
reorder(nil).find_ordered(posts.map(&:id))
end
def random_up(key)