Class: Decidim::DecidimAwesome::DestroyPrivateDataJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- Decidim::DecidimAwesome::DestroyPrivateDataJob
- Defined in:
- app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb
Instance Method Summary collapse
-
#perform(resource) ⇒ Object
Destroys private data associated with the resource.
Instance Method Details
#perform(resource) ⇒ Object
Destroys private data associated with the resource
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb', line 9 def perform(resource) extra_fields = Decidim::DecidimAwesome::ProposalExtraField.where( proposal: Decidim::Proposals::Proposal.where(component: resource) ).where("private_body_updated_at < ?", DecidimAwesome.private_data_expiration_time.ago) extra_fields.find_each do |extra_field| extra_field.update(private_body: nil) end Lock.new(resource.organization).release!(resource) end |