mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 04:36:05 +08:00
FEATURE: Implement new required options in admin user fields UI (#27079)
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
This commit is contained in:
@ -17,6 +17,7 @@ RSpec.describe Admin::UserFieldsController do
|
||||
name: "hello",
|
||||
description: "hello desc",
|
||||
field_type: "text",
|
||||
requirement: "on_signup",
|
||||
},
|
||||
}
|
||||
|
||||
@ -33,6 +34,7 @@ RSpec.describe Admin::UserFieldsController do
|
||||
description: "hello desc",
|
||||
field_type: "dropdown",
|
||||
options: %w[a b c],
|
||||
requirement: "on_signup",
|
||||
},
|
||||
}
|
||||
|
||||
@ -162,13 +164,16 @@ RSpec.describe Admin::UserFieldsController do
|
||||
name: "fraggle",
|
||||
field_type: "confirm",
|
||||
description: "muppet",
|
||||
requirement: "optional",
|
||||
},
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
user_field.reload
|
||||
expect(user_field.name).to eq("fraggle")
|
||||
expect(user_field.field_type).to eq("confirm")
|
||||
expect(user_field.reload).to have_attributes(
|
||||
name: "fraggle",
|
||||
field_type: "confirm",
|
||||
required?: false,
|
||||
)
|
||||
end
|
||||
|
||||
it "updates the user field options" do
|
||||
|
Reference in New Issue
Block a user