Skip to content

Commit

Permalink
fix: unchecking avoid_index applies immediatly
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadrien Froger committed Dec 11, 2024
2 parents c6cc9b3 + 8606fa4 commit fc5e999
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/forms/decidim/geo/admin/geo_config_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GeoConfigForm < Form
attribute :maptiler_style_id, String
attribute :only_assemblies, Boolean
attribute :only_processes, Boolean
attribute :default_geoencoded_filter, Integer
attribute :default_geoencoded_filter, String
attribute :focus_zoom_level, Integer

alias organization current_organization
Expand Down
2 changes: 1 addition & 1 deletion app/views/decidim/geo/admin/geo_configs/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<div class="row">
<div class="columns xlarge-6">
<%= form.select :default_geoencoded_filter, options_for_select(Decidim::Geo::GeoConfig::default_geoencoded_filters.map do |key, value|
[t(key, scope: "decidim.geo.admin.geo_configs.default_filter.geoencoded_filter.fields"), value]
[t(key, scope: "decidim.geo.admin.geo_configs.default_filter.geoencoded_filter.fields"), key]
end, form.object.default_geoencoded_filter), label: t("label", scope: "decidim.geo.admin.geo_configs.default_filter.geoencoded_filter") %>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions lib/decidim/geo/update_geo_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module UpdateGeoComponent
after_commit :update_decidim_geo_index
before_save :set_decidim_geo_trigger_changes
def set_decidim_geo_trigger_changes
@decidim_geo_trigger_changes = !changes.empty?
@decidim_geo_trigger_changes ||= !changes.empty?
end

def update_decidim_geo_index
Expand All @@ -20,7 +20,6 @@ def update_decidim_geo_index
component_id = id
registry = Decidim::Geo::ManifestRegistry.instance
model_klass = registry.model_for(manifest_name)

attached = model_klass.where(component: component_id)
Decidim::Geo::Index.where(component_id: component_id, resource_type: manifest_name).where.not(resource_id: attached.ids).each(&:destroy)
attached.each(&:update_decidim_geo_index)
Expand Down

0 comments on commit fc5e999

Please sign in to comment.