Handle duplicate ActivityPub activities (#4639)
* Handle duplicate ActivityPub activities Only perform side-effects when record processed for the first time * Fast-forward repeat follow requests
This commit is contained in:
parent
93d4192a67
commit
fe5b66aa08
5 changed files with 22 additions and 7 deletions
|
@ -1,9 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AuthorizeFollowService < BaseService
|
||||
def call(source_account, target_account)
|
||||
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
|
||||
follow_request.authorize!
|
||||
def call(source_account, target_account, options = {})
|
||||
if options[:skip_follow_request]
|
||||
follow_request = FollowRequest.new(account: source_account, target_account: target_account)
|
||||
else
|
||||
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
|
||||
follow_request.authorize!
|
||||
end
|
||||
|
||||
create_notification(follow_request) unless source_account.local?
|
||||
follow_request
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue