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:
Ted Johansson
2024-10-21 14:37:46 +08:00
committed by GitHub
parent a017b60879
commit 6f55457652
2 changed files with 25 additions and 1 deletions

View File

@@ -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