diff --git a/gems/houdini_full_contact/app/listeners/houdini/full_contact/full_contact_listener.rb b/gems/houdini_full_contact/app/listeners/houdini/full_contact/full_contact_listener.rb new file mode 100644 index 00000000..16baa258 --- /dev/null +++ b/gems/houdini_full_contact/app/listeners/houdini/full_contact/full_contact_listener.rb @@ -0,0 +1,5 @@ +module Houdini::FullContact::FullContactListener + def supporter_create(supporter) + Houdini::FullContact::InsertInfos.enqueue(supporter.id) + end +end \ No newline at end of file diff --git a/gems/houdini_full_contact/config/initializers/houdini_event_publisher.rb b/gems/houdini_full_contact/config/initializers/houdini_event_publisher.rb new file mode 100644 index 00000000..b9a78315 --- /dev/null +++ b/gems/houdini_full_contact/config/initializers/houdini_event_publisher.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +Rails.application.config.houdini.listeners << Houdini::FullContact::FullContactListener \ No newline at end of file diff --git a/lib/insert/insert_import.rb b/lib/insert/insert_import.rb index 937da4de..ecdc6da3 100644 --- a/lib/insert/insert_import.rb +++ b/lib/insert/insert_import.rb @@ -163,7 +163,9 @@ module InsertImport .where(id: import['id']) .returning('*') .execute.first - Houdini::FullContact::InsertInfos.enqueue(supporter_ids) if supporter_ids.any? + Supporter.where("supporter.ids IN (?)", supporter_ids).each do |s| + Houdini.event_publisher.announce(:supporter_create, s) + end ImportCompletedJob.perform_later(Import.find(import['id'])) import end