Merge remote-tracking branch 'parent/main' into upstream-20241009

This commit is contained in:
KMY 2024-10-09 12:32:11 +09:00
commit d021659cb7
130 changed files with 1120 additions and 917 deletions

View file

@ -95,6 +95,7 @@ class Account < ApplicationRecord
include Account::StatusesSearch
include Account::OtherSettings
include Account::MasterSettings
include Account::Suspensions
include Account::AttributionDomains
include DomainMaterializable
include DomainNormalizable
@ -134,10 +135,7 @@ class Account < ApplicationRecord
scope :local, -> { where(domain: nil) }
scope :partitioned, -> { order(Arel.sql('row_number() over (partition by domain)')) }
scope :silenced, -> { where.not(silenced_at: nil) }
scope :suspended, -> { where.not(suspended_at: nil) }
scope :remote_pending, -> { where(remote_pending: true).where.not(suspended_at: nil) }
scope :sensitized, -> { where.not(sensitized_at: nil) }
scope :without_suspended, -> { where(suspended_at: nil) }
scope :without_silenced, -> { where(silenced_at: nil) }
scope :without_instance_actor, -> { where.not(id: INSTANCE_ACTOR_ID) }
scope :recent, -> { reorder(id: :desc) }
@ -283,58 +281,6 @@ class Account < ApplicationRecord
update!(silenced_at: nil)
end
def suspended?
suspended_at.present? && !instance_actor?
end
def suspended_locally?
suspended? && suspension_origin_local?
end
def suspended_permanently?
suspended? && deletion_request.nil?
end
def suspended_temporarily?
suspended? && deletion_request.present?
end
alias unavailable? suspended?
alias permanently_unavailable? suspended_permanently?
def suspend!(date: Time.now.utc, origin: :local, block_email: true)
transaction do
create_deletion_request!
update!(suspended_at: date, suspension_origin: origin)
create_canonical_email_block! if block_email
end
end
def unsuspend!
transaction do
deletion_request&.destroy!
update!(suspended_at: nil, suspension_origin: nil)
destroy_canonical_email_block!
end
end
def approve_remote!
return unless remote_pending
update!(remote_pending: false)
unsuspend!
ActivateRemoteAccountWorker.perform_async(id)
end
def reject_remote!
return unless remote_pending
update!(remote_pending: false, suspension_origin: :local)
pending_follow_requests.destroy_all
pending_statuses.destroy_all
suspend!
end
def sensitized?
sensitized_at.present?
end