Merge commit '71db616fed' into kb_migration

This commit is contained in:
KMY 2023-07-14 12:43:55 +09:00
commit f18fa97f0c
607 changed files with 3491 additions and 2677 deletions

View file

@ -143,11 +143,11 @@ class ActivityPub::Activity
end
def follow_request_from_object
@follow_request ||= FollowRequest.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
@follow_request_from_object ||= FollowRequest.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
end
def follow_from_object
@follow ||= ::Follow.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
@follow_from_object ||= ::Follow.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?
end
def fetch_remote_original_status

View file

@ -4,13 +4,14 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity
def perform
return if skip_reports?
target_accounts = object_uris.filter_map { |uri| account_from_uri(uri) }.select(&:local?)
target_statuses_by_account = object_uris.filter_map { |uri| status_from_uri(uri) }.select(&:local?).group_by(&:account_id)
target_accounts = object_uris.filter_map { |uri| account_from_uri(uri) }
target_statuses_by_account = object_uris.filter_map { |uri| status_from_uri(uri) }.group_by(&:account_id)
target_accounts.each do |target_account|
target_statuses = target_statuses_by_account[target_account.id]
target_statuses = target_statuses_by_account[target_account.id]
replied_to_accounts = Account.local.where(id: target_statuses.filter_map(&:in_reply_to_account_id))
next if target_account.suspended?
next if target_account.suspended? || (!target_account.local? && replied_to_accounts.none?)
ReportService.new.call(
@account,

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'connection_pool'
require_relative './shared_timed_stack'
require_relative 'shared_timed_stack'
class ConnectionPool::SharedConnectionPool < ConnectionPool
def initialize(options = {}, &block)

View file

@ -53,7 +53,7 @@ class EmojiFormatter
end
end
result << Nokogiri::XML::Text.new(text[last_index..-1], tree.document)
result << Nokogiri::XML::Text.new(text[last_index..], tree.document)
node.replace(result)
end

View file

@ -39,7 +39,7 @@ class InlineRenderer
private
def preload_associations_for_status
ActiveRecord::Associations::Preloader.new.preload(@object, {
ActiveRecord::Associations::Preloader.new(records: @object, associations: {
active_mentions: :account,
reblog: {

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative './connection_pool/shared_connection_pool'
require_relative 'connection_pool/shared_connection_pool'
class RequestPool
def self.current

View file

@ -16,7 +16,7 @@ class RSS::Channel < RSS::Element
end
def last_build_date(date)
append_element('lastBuildDate', date.to_formatted_s(:rfc822))
append_element('lastBuildDate', date.to_fs(:rfc822))
end
def image(url, title, link)

View file

@ -20,7 +20,7 @@ class RSS::Item < RSS::Element
end
def pub_date(date)
append_element('pubDate', date.to_formatted_s(:rfc822))
append_element('pubDate', date.to_fs(:rfc822))
end
def description(str)

View file

@ -62,8 +62,8 @@ class TextFormatter
prefix = url.match(URL_PREFIX_REGEX).to_s
display_url = url[prefix.length, 30]
suffix = url[prefix.length + 30..-1]
cutoff = url[prefix.length..-1].length > 30
suffix = url[prefix.length + 30..]
cutoff = url[prefix.length..].length > 30
<<~HTML.squish.html_safe # rubocop:disable Rails/OutputSafety
<a href="#{h(url)}" target="_blank" rel="#{rel.join(' ')}" translate="no"><span class="invisible">#{h(prefix)}</span><span class="#{cutoff ? 'ellipsis' : ''}">#{h(display_url)}</span><span class="invisible">#{h(suffix)}</span></a>
@ -89,7 +89,7 @@ class TextFormatter
indices.last
end
result << h(text[last_index..-1])
result << h(text[last_index..])
result
end
@ -219,7 +219,7 @@ class TextFormatter
private
def process_program_code(code)
code.gsub(/\n/, '<br>')
code.gsub("\n", '<br>')
end
end
end