Browse Source

Instantly upgrade account to ActivityPub if we receive ActivityPub payload (#4766)

pull/4/head
Eugen Rochko 6 years ago
committed by GitHub
parent
commit
a187dcefa1
2 changed files with 17 additions and 2 deletions
  1. +6
    -2
      app/controllers/activitypub/inboxes_controller.rb
  2. +11
    -0
      app/workers/resolve_remote_account_worker.rb

+ 6
- 2
app/controllers/activitypub/inboxes_controller.rb View File

@ -26,8 +26,12 @@ class ActivityPub::InboxesController < Api::BaseController
end
def upgrade_account
return unless signed_request_account.subscribed?
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id)
if signed_request_account.ostatus?
signed_request_account.update(last_webfingered_at: nil)
ResolveRemoteAccountWorker.perform_async(signed_request_account.acct)
end
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
end
def process_payload

+ 11
- 0
app/workers/resolve_remote_account_worker.rb View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ResolveRemoteAccountWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull', unique: :until_executed
def perform(uri)
ResolveRemoteAccountService.new.call(uri)
end
end

Loading…
Cancel
Save