mirror of https://github.com/mastodon/mastodon
Merge f903a90785
into 65093c619f
This commit is contained in:
commit
2b59eaab95
|
@ -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)
|
||||
MergeWorker.perform_async(target_account.id, account.id) if account.local?
|
||||
|
||||
TriggerWebhookWorker.perform_async('follow.created', 'Follow', follow.id)
|
||||
|
||||
destroy!
|
||||
end
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ class Webhook < ApplicationRecord
|
|||
report.updated
|
||||
status.created
|
||||
status.updated
|
||||
block.created
|
||||
follow.created
|
||||
mute.created
|
||||
).freeze
|
||||
|
||||
attr_writer :current_account
|
||||
|
@ -58,10 +61,12 @@ class Webhook < ApplicationRecord
|
|||
|
||||
def self.permission_for_event(event)
|
||||
case event
|
||||
when 'account.approved', 'account.created', 'account.updated'
|
||||
when 'account.approved', 'account.created', 'account.updated', 'follow.created'
|
||||
:manage_users
|
||||
when 'report.created', 'report.updated'
|
||||
:manage_reports
|
||||
when 'block.created', 'mute.created'
|
||||
:manage_blocks
|
||||
when 'status.created', 'status.updated'
|
||||
:view_devops
|
||||
end
|
||||
|
|
|
@ -14,6 +14,8 @@ class BlockService < BaseService
|
|||
|
||||
block = account.block!(target_account)
|
||||
|
||||
trigger_webhooks block.id
|
||||
|
||||
BlockWorker.perform_async(account.id, target_account.id)
|
||||
create_notification(block) if !target_account.local? && target_account.activitypub?
|
||||
block
|
||||
|
@ -28,4 +30,8 @@ class BlockService < BaseService
|
|||
def build_json(block)
|
||||
Oj.dump(serialize_payload(block, ActivityPub::BlockSerializer))
|
||||
end
|
||||
|
||||
def trigger_webhooks(block_id)
|
||||
TriggerWebhookWorker.perform_async('block.created', 'Block', block_id)
|
||||
end
|
||||
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
|
||||
|
|
|
@ -6,6 +6,8 @@ class MuteService < BaseService
|
|||
|
||||
mute = account.mute!(target_account, notifications: notifications, duration: duration)
|
||||
|
||||
TriggerWebhookWorker.perform_async('mute.created', 'Mute', mute.id)
|
||||
|
||||
if mute.hide_notifications?
|
||||
BlockWorker.perform_async(account.id, target_account.id)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue