Class: Decidim::FindAndUpdateDescendantsJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
decidim-core/app/jobs/decidim/find_and_update_descendants_job.rb

Overview

Update search indexes for each descendants of a given element

Instance Method Summary collapse

Instance Method Details

#perform(element) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
# File 'decidim-core/app/jobs/decidim/find_and_update_descendants_job.rb', line 8

def perform(element)
  descendants_collector = components_for(element)
  descendants_collector << element.comments.to_a if element.respond_to?(:comments)

  return if descendants_collector.blank?

  descendants_collector.each do |descendants|
    next if descendants.blank?

    Decidim::UpdateSearchIndexesJob.perform_later(descendants)
  end
end