Skip to content

A platform for community discussion. Free, open, simple.

DEV: Make silence_reason and can_be_deleted optional (#30647)

Blake Erickson6811296b2456
diff --git a/spec/requests/api/schemas/json/admin_user_response.json b/spec/requests/api/schemas/json/admin_user_response.json
index 9bd90d2100c..f32f1f96951 100644
--- a/spec/requests/api/schemas/json/admin_user_response.json
+++ b/spec/requests/api/schemas/json/admin_user_response.json
@@ -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",
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 39f8e97e41b..28a720c2e4a 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -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
-
- # parameter name: :id, in: :path, type: :integer, required: true
-
- # 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)
-
- # 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
+ 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
+
+ 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)
+
+ 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"