Skip to content

Commit

Permalink
Check visibility on required custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Jul 31, 2024
1 parent f47fd4f commit c82e4ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/projects/custom_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def available_custom_fields
return all_visible_custom_fields if new_record?

all_visible_custom_fields.where(id: project_custom_field_project_mappings.select(:custom_field_id))
.or(ProjectCustomField.required)
.or(required_visible_custom_fields)
end

# Note:
Expand All @@ -64,6 +64,10 @@ def all_visible_custom_fields
all_available_custom_fields.visible(project: self)
end

def required_visible_custom_fields
ProjectCustomField.required.visible(project: self)
end

def custom_field_values_to_validate
# Limit the set of available custom fields when the validation is limited to a section
if _limit_custom_fields_validation_to_section_id
Expand Down

0 comments on commit c82e4ea

Please sign in to comment.