diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 3c5e8f96f0d..93c72ce1b27 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -35,6 +35,9 @@ class FollowRequest < ApplicationRecord follow = account.follow!(target_account, reblogs: show_reblogs, notify: notify, languages: languages, uri: uri, bypass_limit: true) ListAccount.where(follow_request: self).update_all(follow_request_id: nil, follow_id: follow.id) # rubocop:disable Rails/SkipsModelValidations MergeWorker.perform_async(target_account.id, account.id) if account.local? + + TriggerWebhookWorker.perform_async('follow.created', 'Follow', follow.id) + destroy! end diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index af5f996077e..72dd720dcdc 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -39,7 +39,9 @@ class FollowService < BaseService if (@target_account.locked? && !@options[:bypass_locked]) || @source_account.silenced? || @target_account.activitypub? request_follow! elsif @target_account.local? - direct_follow! + follow = direct_follow! + trigger_webhooks follow.id + follow end end @@ -93,4 +95,8 @@ class FollowService < BaseService def follow_options @options.slice(:reblogs, :notify, :languages) end + + def trigger_webhooks(follow_id) + TriggerWebhookWorker.perform_async('follow.created', 'Follow', follow_id) + end end