2018-09-18 10:45:58 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class VerifyAccountLinksWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2022-11-09 02:24:21 -05:00
|
|
|
sidekiq_options queue: 'default', retry: false, lock: :until_executed
|
2018-09-18 10:45:58 -04:00
|
|
|
|
|
|
|
def perform(account_id)
|
|
|
|
account = Account.find(account_id)
|
|
|
|
|
|
|
|
account.fields.each do |field|
|
2022-11-09 02:24:21 -05:00
|
|
|
VerifyLinkService.new.call(field) if field.requires_verification?
|
2018-09-18 10:45:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
account.save! if account.changed?
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|