Create Houdini::FullContact::FullContactListener and set up

This commit is contained in:
Eric 2020-06-18 14:21:42 -05:00 committed by Eric Schultz
parent 238eba4a50
commit f7e33f85aa
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,5 @@
module Houdini::FullContact::FullContactListener
def supporter_create(supporter)
Houdini::FullContact::InsertInfos.enqueue(supporter.id)
end
end

View file

@ -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

View file

@ -163,7 +163,9 @@ module InsertImport
.where(id: import['id']) .where(id: import['id'])
.returning('*') .returning('*')
.execute.first .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'])) ImportCompletedJob.perform_later(Import.find(import['id']))
import import
end end