diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-08-20 16:53:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-20 16:53:47 +0200 |
commit | fe5b66aa0870212e27a6632fb9c83a2d16bd99ab (patch) | |
tree | 4a5b53f21f2c29462d5c58afa2f2a03b30f702c4 /app/services | |
parent | 93d4192a67fde9aaf0c4e420cb5ecb5fe921e97c (diff) |
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
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/authorize_follow_service.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/services/authorize_follow_service.rb b/app/services/authorize_follow_service.rb index db35b6030..6f036dc5a 100644 --- a/app/services/authorize_follow_service.rb +++ b/app/services/authorize_follow_service.rb @@ -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 |