Fix #4606: Add only= support for modqueue.

This commit is contained in:
evazion
2022-09-27 22:21:11 -05:00
parent 04b004d2a4
commit 91c8038685
2 changed files with 14 additions and 2 deletions

View File

@@ -23,6 +23,6 @@ class ModqueueController < ApplicationController
@preview_size = params[:size].presence || cookies[:post_preview_size].presence || PostPreviewComponent::DEFAULT_SIZE
respond_with(@posts)
respond_with(@posts, model: "Post")
end
end

View File

@@ -5,7 +5,7 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest
setup do
@admin = create(:admin_user)
@user = create(:user)
@post = as(@user) { create(:post, is_pending: true) }
@post = create(:post, is_pending: true)
end
context "index action" do
@@ -14,6 +14,18 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
should "render for a json response" do
get_auth modqueue_index_path, @admin, as: :json
assert_response :success
end
should "support the only= URL param" do
get_auth modqueue_index_path(only: "rating"), @admin, as: :json
assert_response :success
assert_equal([{ "rating" => @post.rating }], response.parsed_body)
end
should "include appealed posts in the modqueue" do
@appeal = create(:post_appeal)
get_auth modqueue_index_path, @admin