diff options
author | ThibG <thib@sitedethib.com> | 2018-09-21 08:39:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-21 08:39:07 +0200 |
commit | 17464c10ad1693095a05fe445587804589d627e1 (patch) | |
tree | ecd2a077b038b864ac7912cba72dd59990fb6258 /app/workers/verify_account_links_worker.rb | |
parent | 382cdd7f959480d59fee5646be320d6076cb18d8 (diff) | |
parent | 343acd96cccb16b1ecdc3a52a8733359d4a92633 (diff) |
Merge pull request #739 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/workers/verify_account_links_worker.rb')
-rw-r--r-- | app/workers/verify_account_links_worker.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/workers/verify_account_links_worker.rb b/app/workers/verify_account_links_worker.rb new file mode 100644 index 000000000..901498583 --- /dev/null +++ b/app/workers/verify_account_links_worker.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class VerifyAccountLinksWorker + include Sidekiq::Worker + + sidekiq_options queue: 'pull', retry: false, unique: :until_executed + + def perform(account_id) + account = Account.find(account_id) + + account.fields.each do |field| + next unless !field.verified? && field.verifiable? + VerifyLinkService.new.call(field) + end + + account.save! if account.changed? + rescue ActiveRecord::RecordNotFound + true + end +end |