Fix method name to config in SafeSettings and update usages accordingly

This commit is contained in:
Eugene Burmakin 2025-12-06 12:29:44 +01:00
parent fafa152b58
commit 6fec2f0e0f
3 changed files with 15 additions and 6 deletions

View file

@ -31,7 +31,7 @@ class Api::V1::SettingsController < ApiController
:preferred_map_layer, :points_rendering_mode, :live_map_enabled,
:immich_url, :immich_api_key, :photoprism_url, :photoprism_api_key,
:speed_colored_routes, :speed_color_scale, :fog_of_war_threshold,
:maps_v2_style,
:maps_v2_style, :maps_maplibre_style,
enabled_map_layers: []
)
end

View file

@ -20,7 +20,8 @@ class Users::SafeSettings
'photoprism_api_key' => nil,
'maps' => { 'distance_unit' => 'km' },
'visits_suggestions_enabled' => 'true',
'enabled_map_layers' => ['Routes', 'Heatmap']
'enabled_map_layers' => ['Routes', 'Heatmap'],
'maps_maplibre_style' => 'light'
}.freeze
def initialize(settings = {})
@ -49,7 +50,8 @@ class Users::SafeSettings
visits_suggestions_enabled: visits_suggestions_enabled?,
speed_color_scale: speed_color_scale,
fog_of_war_threshold: fog_of_war_threshold,
enabled_map_layers: enabled_map_layers
enabled_map_layers: enabled_map_layers,
maps_maplibre_style: maps_maplibre_style
}
end
# rubocop:enable Metrics/MethodLength
@ -133,4 +135,8 @@ class Users::SafeSettings
def enabled_map_layers
settings['enabled_map_layers']
end
def maps_maplibre_style
settings['maps_maplibre_style']
end
end

View file

@ -30,7 +30,8 @@ RSpec.describe Users::SafeSettings do
visits_suggestions_enabled: true,
speed_color_scale: nil,
fog_of_war_threshold: nil,
enabled_map_layers: ['Routes', 'Heatmap']
enabled_map_layers: ['Routes', 'Heatmap'],
maps_maplibre_style: 'light'
}
)
end
@ -79,7 +80,8 @@ RSpec.describe Users::SafeSettings do
"photoprism_api_key" => "photoprism-key",
"maps" => { "name" => "custom", "url" => "https://custom.example.com" },
"visits_suggestions_enabled" => false,
"enabled_map_layers" => ['Points', 'Routes', 'Areas', 'Photos']
"enabled_map_layers" => ['Points', 'Routes', 'Areas', 'Photos'],
"maps_maplibre_style" => "light"
}
)
end
@ -106,7 +108,8 @@ RSpec.describe Users::SafeSettings do
visits_suggestions_enabled: false,
speed_color_scale: nil,
fog_of_war_threshold: nil,
enabled_map_layers: ['Points', 'Routes', 'Areas', 'Photos']
enabled_map_layers: ['Points', 'Routes', 'Areas', 'Photos'],
maps_maplibre_style: 'light'
}
)
end