* Add: #591 リモート保留中アカウントからメンションが来た場合にuriを記録し、承認時にフェッチしに行く処理 * Rename fetch_remove_status_worker.rb to fetch_remote_status_worker.rb * Wip * Add lock code
This commit is contained in:
parent
b2acc7dbb8
commit
2ab9ea642a
22 changed files with 307 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class EnableFollowRequestsService < BaseService
|
||||
class ActivateFollowRequestsService < BaseService
|
||||
include Payloadable
|
||||
include FollowHelper
|
||||
|
31
app/services/activate_remote_statuses_service.rb
Normal file
31
app/services/activate_remote_statuses_service.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivateRemoteStatusesService < BaseService
|
||||
include Payloadable
|
||||
include FollowHelper
|
||||
|
||||
def call(account)
|
||||
@account = account
|
||||
|
||||
PendingStatus.transaction do
|
||||
PendingStatus.where(account: account).find_each do |status_info|
|
||||
approve_status!(status_info)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def approve_status!(pending)
|
||||
account_id = pending.account_id
|
||||
fetch_account_id = pending.fetch_account_id
|
||||
fetch_account = pending.fetch_account
|
||||
uri = pending.uri
|
||||
pending.destroy!
|
||||
|
||||
return if fetch_account.suspended?
|
||||
return if ActivityPub::TagManager.instance.uri_to_resource(uri, Status).present?
|
||||
|
||||
ActivityPub::FetchRemoteStatusWorker.perform_async(uri, account_id, fetch_account_id)
|
||||
end
|
||||
end
|
|
@ -56,7 +56,7 @@ class ActivityPub::ProcessCollectionService < BaseService
|
|||
end
|
||||
|
||||
def activity_allowed_while_remote_pending?
|
||||
%w(Follow).include?(@json['type']) || activity_allowed_while_suspended?
|
||||
%w(Follow Create).include?(@json['type']) || activity_allowed_while_suspended?
|
||||
end
|
||||
|
||||
def process_items(items)
|
||||
|
|
|
@ -20,6 +20,7 @@ class DeleteAccountService < BaseService
|
|||
devices
|
||||
domain_blocks
|
||||
featured_tags
|
||||
fetchable_pending_statuses
|
||||
follow_requests
|
||||
list_accounts
|
||||
migrations
|
||||
|
@ -29,6 +30,7 @@ class DeleteAccountService < BaseService
|
|||
owned_lists
|
||||
passive_relationships
|
||||
pending_follow_requests
|
||||
pending_statuses
|
||||
report_notes
|
||||
scheduled_statuses
|
||||
scheduled_expiration_statuses
|
||||
|
@ -51,6 +53,7 @@ class DeleteAccountService < BaseService
|
|||
devices
|
||||
domain_blocks
|
||||
featured_tags
|
||||
fetchable_pending_statuses
|
||||
follow_requests
|
||||
list_accounts
|
||||
migrations
|
||||
|
@ -59,6 +62,7 @@ class DeleteAccountService < BaseService
|
|||
notifications
|
||||
owned_lists
|
||||
pending_follow_requests
|
||||
pending_statuses
|
||||
scheduled_statuses
|
||||
scheduled_expiration_statuses
|
||||
status_pins
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue