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