Merge commit 'f877aa9d70' into kb_migration

This commit is contained in:
KMY 2023-05-07 14:50:12 +09:00
commit 32f0e619f0
440 changed files with 6249 additions and 3435 deletions

View file

@ -67,7 +67,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
end
def split_acct(acct)
acct.gsub(/\Aacct:/, '').split('@')
acct.delete_prefix('acct:').split('@')
end
def supported_context?

View file

@ -2,12 +2,15 @@
class ActivityPub::FetchRemoteStatusService < BaseService
include JsonLdHelper
include DomainControlHelper
include Redisable
DISCOVERIES_PER_REQUEST = 1000
# Should be called when uri has already been checked for locality
def call(uri, id: true, prefetched_body: nil, on_behalf_of: nil, expected_actor_uri: nil, request_id: nil)
return if domain_not_allowed?(uri)
@request_id = request_id || "#{Time.now.utc.to_i}-status-#{uri}"
@json = if prefetched_body.nil?
fetch_resource(uri, id, on_behalf_of)

View file

@ -24,7 +24,7 @@ class ActivityPub::ProcessAccountService < BaseService
# The key does not need to be unguessable, it just needs to be somewhat unique
@options[:request_id] ||= "#{Time.now.utc.to_i}-#{username}@#{domain}"
with_lock("process_account:#{@uri}") do
with_redis_lock("process_account:#{@uri}") do
@account = Account.remote.find_by(uri: @uri) if @options[:only_key]
@account ||= Account.find_remote(@username, @domain)
@old_public_key = @account&.public_key

View file

@ -35,7 +35,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
last_edit_date = @status.edited_at.presence || @status.created_at
# Only allow processing one create/update per status at a time
with_lock("create:#{@uri}") do
with_redis_lock("create:#{@uri}") do
Status.transaction do
record_previous_edit!
update_media_attachments!
@ -58,7 +58,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
end
def handle_implicit_update!
with_lock("create:#{@uri}") do
with_redis_lock("create:#{@uri}") do
update_poll!(allow_significant_changes: false)
queue_poll_notifications!
end