Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- | 1 | # frozen_string_literal: true
- | 2 |
- | 3 | class ActivityPub::InboxesController < Api::BaseController
- | 4 | include SignatureVerification
- | 5 |
- | 6 | before_action :set_account
- | 7 |
- | 8 | def create
- 18 (15.3%) | 9 | if signed_request_account
- 1 (0.8%) | 10 | upgrade_account
- 9 (7.6%) | 11 | process_payload
- 2 (1.7%) | 12 | head 201
- | 13 | else
- | 14 | head 202
- | 15 | end
- | 16 | end
- | 17 |
- | 18 | private
- | 19 |
- | 20 | def set_account
- 31 (26.3%) | 21 | @account = Account.find_local!(params[:account_username]) if params[:account_username]
- | 22 | end
- | 23 |
- | 24 | def body
- | 25 | @body ||= request.body.read
- | 26 | end
- | 27 |
- | 28 | def upgrade_account
- 1 (0.8%) | 29 | if signed_request_account.ostatus?
- | 30 | signed_request_account.update(last_webfingered_at: nil)
- | 31 | ResolveRemoteAccountWorker.perform_async(signed_request_account.acct)
- | 32 | end
- | 33 |
- | 34 | Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
- | 35 | end
- | 36 |
- | 37 | def process_payload
- 9 (7.6%) | 38 | ActivityPub::ProcessingWorker.perform_async(signed_request_account.id, body.force_encoding('UTF-8'))
- | 39 | end
- | 40 | end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement