diff --git a/app/models/user.rb b/app/models/user.rb index 71cec864c8b..178b4cb6bae 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1873,7 +1873,7 @@ class User < ActiveRecord::Base def populated_required_custom_fields? UserField - .required + .for_all_users .pluck(:id) .all? { |field_id| custom_fields["#{User::USER_FIELD_PREFIX}#{field_id}"].present? } end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 817fee20038..91f60a39ded 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3587,7 +3587,10 @@ RSpec.describe User do end describe "#populated_required_fields?" do - let!(:required_field) { Fabricate(:user_field, name: "hairstyle") } + let!(:required_field) do + Fabricate(:user_field, name: "hairstyle", requirement: "for_all_users") + end + let!(:signup_field) { Fabricate(:user_field, name: "haircolor", requirement: "on_signup") } let!(:optional_field) { Fabricate(:user_field, name: "haircolor", requirement: "optional") } context "when all required fields are populated" do