about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-09-19 21:46:01 +0200
committerThibaut Girka <thib@sitedethib.com>2018-09-19 21:46:01 +0200
commit91bef4759f40422b64d7990f9b90db0b493773b1 (patch)
tree3211b1014a6d0a88737db16c44d210ef96a070e4 /app/workers
parent382cdd7f959480d59fee5646be320d6076cb18d8 (diff)
parent554f659f2aa1eb9c0ca64ec1c9c177538434826c (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
	Vagrantfile
	app/javascript/packs/public.js
	app/views/admin/settings/edit.html.haml
	app/views/settings/preferences/show.html.haml
	app/views/settings/profiles/show.html.haml
	config/locales/es.yml
	config/locales/simple_form.en.yml
	config/webpack/configuration.js
	config/webpack/loaders/babel.js
	package.json
	yarn.lock

Split new additions to app/javascript/packs/public.js to
app/javascript/core/settings.js
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/verify_account_links_worker.rb20
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