Addo domein block extra supports
This commit is contained in:
parent
bb7fa1d060
commit
9ad92e6a09
24 changed files with 331 additions and 35 deletions
|
@ -215,7 +215,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def process_hashtag(tag)
|
||||
return if tag['name'].blank?
|
||||
return if tag['name'].blank? || ignore_hashtags?
|
||||
|
||||
Tag.find_or_create_by_names(tag['name']) do |hashtag|
|
||||
@tags << hashtag unless @tags.include?(hashtag) || !hashtag.valid?
|
||||
|
@ -392,6 +392,14 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
!replied_to_status.nil? && replied_to_status.account.local?
|
||||
end
|
||||
|
||||
def reject_reply_to_local?
|
||||
@reject_reply_to_local ||= DomainBlock.reject_reply?(@account.domain)
|
||||
end
|
||||
|
||||
def ignore_hashtags?
|
||||
@ignore_hashtags ||= DomainBlock.reject_hashtag?(@account.domain)
|
||||
end
|
||||
|
||||
def related_to_local_activity?
|
||||
fetch? || followed_by_local_accounts? || requested_through_relay? ||
|
||||
responds_to_followed_account? || addresses_local_accounts?
|
||||
|
|
|
@ -15,7 +15,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
|
|||
return
|
||||
end
|
||||
|
||||
if target_account.blocking?(@account) || target_account.domain_blocking?(@account.domain) || target_account.moved? || target_account.instance_actor?
|
||||
if target_account.blocking?(@account) || target_account.domain_blocking?(@account.domain) || target_account.moved? || target_account.instance_actor? || block_new_follow?
|
||||
reject_follow_request!(target_account)
|
||||
return
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
|
|||
|
||||
follow_request = FollowRequest.create!(account: @account, target_account: target_account, uri: @json['id'])
|
||||
|
||||
if target_account.locked? || @account.silenced?
|
||||
if target_account.locked? || @account.silenced? || block_straight_follow?
|
||||
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, 'FollowRequest', 'follow_request')
|
||||
else
|
||||
AuthorizeFollowService.new.call(@account, target_account)
|
||||
|
@ -42,4 +42,12 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
|
|||
json = Oj.dump(serialize_payload(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), ActivityPub::RejectFollowSerializer))
|
||||
ActivityPub::DeliveryWorker.perform_async(json, target_account.id, @account.inbox_url)
|
||||
end
|
||||
|
||||
def block_straight_follow?
|
||||
@block_straight_follow ||= DomainBlock.reject_straight_follow?(@account.domain)
|
||||
end
|
||||
|
||||
def block_new_follow?
|
||||
@block_new_follow ||= DomainBlock.reject_new_follow?(@account.domain)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue