about summary refs log tree commit diff
path: root/app/workers/verify_account_links_worker.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-09-18 16:45:58 +0200
committerGitHub <noreply@github.com>2018-09-18 16:45:58 +0200
commitf4d549d30081478b1fe2bde9d340262e132bb891 (patch)
treed920447e62986f1ec47ce88084cf58a7abcad312 /app/workers/verify_account_links_worker.rb
parentf8b54d229f70cb726511bcd35e1440618e487672 (diff)
Redesign forms, verify link ownership with rel="me" (#8703)
* Verify link ownership with rel="me"

* Add explanation about verification to UI

* Perform link verifications

* Add click-to-copy widget for verification HTML

* Redesign edit profile page

* Redesign forms

* Improve responsive design of settings pages

* Restore landing page sign-up form

* Fix typo

* Support <link> tags, add spec

* Fix links not being verified on first discovery and passive updates
Diffstat (limited to 'app/workers/verify_account_links_worker.rb')
-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