Merge commit '3554c527954441fd924586a49c7d99a89101ac7e' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/authorize_interactions_controller.rb`: Small conflict due to our theming system. - `streaming/index.js`: Upstream refactored part of the streaming server. We had some extra logic for handling local-only posts. Applied the refactor.
This commit is contained in:
@ -9,7 +9,7 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity
|
||||
|
||||
target_accounts.each do |target_account|
|
||||
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))
|
||||
replied_to_accounts = target_statuses.nil? ? [] : Account.local.where(id: target_statuses.filter_map(&:in_reply_to_account_id))
|
||||
|
||||
next if target_account.suspended? || (!target_account.local? && replied_to_accounts.none?)
|
||||
|
||||
|
@ -76,6 +76,9 @@ class AttachmentBatch
|
||||
when :fog
|
||||
logger.debug { "Deleting #{attachment.path(style)}" }
|
||||
attachment.directory.files.new(key: attachment.path(style)).destroy
|
||||
when :azure
|
||||
logger.debug { "Deleting #{attachment.path(style)}" }
|
||||
attachment.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
26
app/lib/importer/instances_index_importer.rb
Normal file
26
app/lib/importer/instances_index_importer.rb
Normal file
@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Importer::InstancesIndexImporter < Importer::BaseImporter
|
||||
def import!
|
||||
index.adapter.default_scope.find_in_batches(batch_size: @batch_size) do |tmp|
|
||||
in_work_unit(tmp) do |instances|
|
||||
bulk = Chewy::Index::Import::BulkBuilder.new(index, to_index: instances).bulk_body
|
||||
|
||||
indexed = bulk.count { |entry| entry[:index] }
|
||||
deleted = bulk.count { |entry| entry[:delete] }
|
||||
|
||||
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
|
||||
|
||||
[indexed, deleted]
|
||||
end
|
||||
end
|
||||
|
||||
wait!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def index
|
||||
InstancesIndex
|
||||
end
|
||||
end
|
@ -11,6 +11,8 @@ class WebfingerResource
|
||||
|
||||
def username
|
||||
case resource
|
||||
when %r{\A(https?://)?#{instance_actor_regexp}/?\Z}
|
||||
Rails.configuration.x.local_domain
|
||||
when /\Ahttps?/i
|
||||
username_from_url
|
||||
when /@/
|
||||
@ -22,6 +24,13 @@ class WebfingerResource
|
||||
|
||||
private
|
||||
|
||||
def instance_actor_regexp
|
||||
hosts = [Rails.configuration.x.local_domain, Rails.configuration.x.web_domain]
|
||||
hosts.concat(Rails.configuration.x.alternate_domains) if Rails.configuration.x.alternate_domains.present?
|
||||
|
||||
Regexp.union(hosts)
|
||||
end
|
||||
|
||||
def username_from_url
|
||||
if account_show_page?
|
||||
path_params[:username]
|
||||
|
Reference in New Issue
Block a user