diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index 6b44f8cf0..a2b291caa 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -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 diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index 8b6d87c82..547585724 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -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