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

This commit is contained in:
KMY 2023-12-04 12:04:52 +09:00
commit 94c2396a34
179 changed files with 1036 additions and 775 deletions

View file

@ -44,7 +44,9 @@ class AccountStatusesFilter
private
def initial_scope
if (suspended? || (domain_block&.reject_send_dissubscribable && !@account.all_subscribable?)) || domain_block&.reject_send_media || blocked?
return Status.none if account.unavailable?
if (domain_block&.reject_send_dissubscribable && !@account.all_subscribable?) || domain_block&.reject_send_media || blocked?
Status.none
elsif anonymous?
account.statuses.where(visibility: %i(public unlisted public_unlisted))
@ -80,7 +82,7 @@ class AccountStatusesFilter
end
def only_media_scope
Status.joins(:media_attachments).merge(account.media_attachments.reorder(nil)).group(Status.arel_table[:id])
Status.joins(:media_attachments).merge(account.media_attachments).group(Status.arel_table[:id])
end
def no_replies_scope
@ -105,10 +107,6 @@ class AccountStatusesFilter
end
end
def suspended?
account.suspended?
end
def anonymous?
current_account.nil?
end

View file

@ -9,7 +9,7 @@ class ActivityPub::Activity::Move < ActivityPub::Activity
target_account = ActivityPub::FetchRemoteAccountService.new.call(target_uri)
if target_account.nil? || target_account.suspended? || !target_account.also_known_as.include?(origin_account.uri)
if target_account.nil? || target_account.unavailable? || !target_account.also_known_as.include?(origin_account.uri)
unmark_as_processing!
return
end

View file

@ -9,8 +9,8 @@ class ContentSecurityPolicy
url_from_configured_asset_host || url_from_base_host
end
def media_host
cdn_host_value || assets_host
def media_hosts
[assets_host, cdn_host_value].compact
end
private

View file

@ -458,8 +458,8 @@ class FeedManager
check_for_blocks = status.active_mentions.pluck(:account_id)
check_for_blocks.push(status.in_reply_to_account) if status.reply? && !status.in_reply_to_account_id.nil?
should_filter = blocks_or_mutes?(receiver_id, check_for_blocks, :mentions) # Filter if it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked (or muted)
should_filter ||= (status.account.silenced? && !Follow.where(account_id: receiver_id, target_account_id: status.account_id).exists?) # of if the account is silenced and I'm not following them
should_filter = blocks_or_mutes?(receiver_id, check_for_blocks, :mentions) # Filter if it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked (or muted)
should_filter ||= status.account.silenced? && !Follow.where(account_id: receiver_id, target_account_id: status.account_id).exists? # of if the account is silenced and I'm not following them
should_filter
end

View file

@ -27,11 +27,11 @@ class Vacuum::MediaAttachmentsVacuum
end
def media_attachments_past_retention_period
MediaAttachment.unscoped.remote.cached.where(MediaAttachment.arel_table[:created_at].lt(@retention_period.ago)).where(MediaAttachment.arel_table[:updated_at].lt(@retention_period.ago))
MediaAttachment.remote.cached.where(MediaAttachment.arel_table[:created_at].lt(@retention_period.ago)).where(MediaAttachment.arel_table[:updated_at].lt(@retention_period.ago))
end
def orphaned_media_attachments
MediaAttachment.unscoped.unattached.where(MediaAttachment.arel_table[:created_at].lt(TTL.ago))
MediaAttachment.unattached.where(MediaAttachment.arel_table[:created_at].lt(TTL.ago))
end
def retention_period?