mirror of https://github.com/mastodon/mastodon
Add follow.created webhook
This commit is contained in:
parent
eed4eef39a
commit
f41f320985
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue