DEV: Make silence_reason and can_be_deleted optional (#30647)

In the api docs note that `silence_reason` and `can_be_deleted` are
optional responses for the admin user api response.

Follow up to: 9cf78ba195

> TODO @blake / @sam - this is not passing cause "silence_reason" is a conditional attribute
> (also can_be_deleted is) - we need to figure out how to not include it in the schema - it is not included
> in the admin response by design
This commit is contained in:
Blake Erickson 2025-01-08 12:43:39 -07:00 committed by GitHub
parent 55914bf9a3
commit 6811296b24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 23 deletions

View File

@ -533,11 +533,9 @@
"flags_received_count",
"private_topics_count",
"can_delete_all_posts",
"can_be_deleted",
"can_be_anonymized",
"can_be_merged",
"full_suspend_reason",
"silence_reason",
"primary_group_id",
"badge_count",
"warnings_received_count",

View File

@ -315,31 +315,27 @@ RSpec.describe "users" do
end
path "/admin/users/{id}.json" do
# TODO @blake / @sam - this is not passing cause "silence_reason" is a conditional attribute
# (also can_be_deleted is) - we need to figure out how to not include it in the schema - it is not included
# in the admin response by design
#
# get "Get a user by id" do
# tags "Users", "Admin"
# operationId "adminGetUser"
# consumes "application/json"
# expected_request_schema = nil
get "Get a user by id" do
tags "Users", "Admin"
operationId "adminGetUser"
consumes "application/json"
expected_request_schema = nil
# parameter name: :id, in: :path, type: :integer, required: true
parameter name: :id, in: :path, type: :integer, required: true
# produces "application/json"
# response "200", "response" do
# let(:id) { Fabricate(:user).id }
produces "application/json"
response "200", "response" do
let(:id) { Fabricate(:user).id }
# expected_response_schema = load_spec_schema("admin_user_response")
# schema(expected_response_schema)
expected_response_schema = load_spec_schema("admin_user_response")
schema(expected_response_schema)
# it_behaves_like "a JSON endpoint", 200 do
# let(:expected_response_schema) { expected_response_schema }
# let(:expected_request_schema) { expected_request_schema }
# end
# end
# end
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }
let(:expected_request_schema) { expected_request_schema }
end
end
end
delete "Delete a user" do
tags "Users", "Admin"