Add follow.created webhook

This commit is contained in:
CSDUMMI 2024-01-09 18:19:01 +01:00
parent eed4eef39a
commit f41f320985
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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