Fix #4606: Add only= support for modqueue.
This commit is contained in:
@@ -23,6 +23,6 @@ class ModqueueController < ApplicationController
|
|||||||
|
|
||||||
@preview_size = params[:size].presence || cookies[:post_preview_size].presence || PostPreviewComponent::DEFAULT_SIZE
|
@preview_size = params[:size].presence || cookies[:post_preview_size].presence || PostPreviewComponent::DEFAULT_SIZE
|
||||||
|
|
||||||
respond_with(@posts)
|
respond_with(@posts, model: "Post")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest
|
|||||||
setup do
|
setup do
|
||||||
@admin = create(:admin_user)
|
@admin = create(:admin_user)
|
||||||
@user = create(:user)
|
@user = create(:user)
|
||||||
@post = as(@user) { create(:post, is_pending: true) }
|
@post = create(:post, is_pending: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
@@ -14,6 +14,18 @@ class ModqueueControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
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
|
should "include appealed posts in the modqueue" do
|
||||||
@appeal = create(:post_appeal)
|
@appeal = create(:post_appeal)
|
||||||
get_auth modqueue_index_path, @admin
|
get_auth modqueue_index_path, @admin
|
||||||
|
|||||||
Reference in New Issue
Block a user