mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
fix: preserve Generic investment subtypes in account creation form (#1465)
* Addressable RegExp Denial of Service * fix: preserve Generic investment subtypes in account creation form The .compact call in Investment.subtypes_grouped_for_select removed all nil values from the region order array, which inadvertently excluded Generic subtypes (region: nil) from the dropdown for all users regardless of currency setting. Replace .compact with conditional logic that preserves nil in the region order while still handling the user_region placement. Closes #1446 * Breakage on `main` reverted * style: fix SpaceInsideArrayLiteralBrackets lint offense Add spaces inside array literal brackets to match project Rubocop rules. --------- Co-authored-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: khanhkhanhlele <namkhanh2172@gmail.com>
This commit is contained in:
@@ -102,7 +102,11 @@ class Investment < ApplicationRecord
|
||||
|
||||
# Build region order: user's region first (if known), then Generic, then others
|
||||
other_regions = %w[us uk ca au eu] - [ user_region ].compact
|
||||
region_order = [ user_region, nil, *other_regions ].compact.uniq
|
||||
region_order = if user_region
|
||||
[ user_region, nil, *other_regions ].uniq
|
||||
else
|
||||
[ nil, *other_regions ].uniq
|
||||
end
|
||||
|
||||
region_order.filter_map do |region|
|
||||
next unless grouped[region]
|
||||
|
||||
Reference in New Issue
Block a user