mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Don't ask admin to re-confirm 'for all users' when requirement didn't change (#29307)
When adding or updating a custom user field to apply to all users (retroactively) we want to alert the admin that this will force all existing users to fill up the field before they are able to access the forum again. However, we currently show this prompt when making changes only to other attributes on the custom field, i.e. the requirement hasn't changed. This commit fixes that.
This commit is contained in:
@@ -59,4 +59,22 @@ describe "Admin User Fields", type: :system, js: true do
|
||||
|
||||
expect(page).to have_text(I18n.t("admin_js.admin.user_fields.requirement.confirmation"))
|
||||
end
|
||||
|
||||
context "when editing an existing user field" do
|
||||
fab!(:user_field) { Fabricate(:user_field, requirement: "for_all_users") }
|
||||
|
||||
it "does not require confirmation if the field already applies to all users" do
|
||||
user_fields_page.visit
|
||||
|
||||
page.find(".user-field .edit").click
|
||||
|
||||
form = page.find(".user-field")
|
||||
|
||||
form.find(".user-field-name").fill_in(with: "Favourite Transformer")
|
||||
|
||||
form.find(".btn-primary").click
|
||||
|
||||
expect(page).to have_no_text(I18n.t("admin_js.admin.user_fields.requirement.confirmation"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user