posts: hotfix bug in /posts.json?tags=blah+order:random.

This commit is contained in:
evazion
2019-08-19 18:48:44 -05:00
parent 782d9f3d61
commit 0b14146f6a
2 changed files with 4 additions and 1 deletions

View File

@@ -137,7 +137,7 @@ module PostSets
end
# XXX HACK: uploader_name is needed in api responses and in data-uploader attribs (visible to mods only).
temp = temp.includes(:uploader) if format.to_sym != :html || CurrentUser.is_moderator?
temp = temp.includes(:uploader) if !is_random? && (format.to_sym != :html || CurrentUser.is_moderator?)
temp.each # hack to force rails to eager load
temp

View File

@@ -146,6 +146,9 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
get posts_path, params: { random: "1" }
assert_response :success
get posts_path(format: :json), params: { random: "1" }
assert_response :success
end
end
end