Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `app/javascript/mastodon/features/compose/components/poll_form.js`:
  glitch-soc change because of having changed the default number of
  available poll options.
  Applied upstream's changes while keeping glitch-soc's default number of
  poll options.
- `public/oops.png`:
  We had a minor graphics change, probably not worth diverging from upstream.
  Took upstream version.
This commit is contained in:
Claire
2022-11-06 09:50:41 +01:00
503 changed files with 8593 additions and 4058 deletions
@@ -14,7 +14,7 @@ class AccountStatusesCleanupService < BaseService
last_deleted = nil
account_policy.statuses_to_delete(budget, cutoff_id, account_policy.last_inspected).reorder(nil).find_each(order: :asc) do |status|
status.discard
status.discard_with_reblogs
RemovalWorker.perform_async(status.id, { 'redraft' => false })
num_deleted += 1
last_deleted = status.id
+10 -1
View File
@@ -14,6 +14,7 @@ class FanOutOnWriteService < BaseService
@options = options
check_race_condition!
warm_payload_cache!
fan_out_to_local_recipients!
fan_out_to_public_recipients! if broadcastable?
@@ -143,13 +144,21 @@ class FanOutOnWriteService < BaseService
AccountConversation.add_status(@account, @status) unless update?
end
def warm_payload_cache!
Rails.cache.write("fan-out/#{@status.id}", rendered_status)
end
def anonymous_payload
@anonymous_payload ||= Oj.dump(
event: update? ? :'status.update' : :update,
payload: InlineRenderer.render(@status, nil, :status)
payload: rendered_status
)
end
def rendered_status
@rendered_status ||= InlineRenderer.render(@status, nil, :status)
end
def update?
@options[:update]
end
+5
View File
@@ -112,6 +112,11 @@ class ImportService < BaseService
next if status.nil? && ActivityPub::TagManager.instance.local_uri?(uri)
status || ActivityPub::FetchRemoteStatusService.new.call(uri)
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError
nil
rescue StandardError => e
Rails.logger.warn "Unexpected error when importing bookmark: #{e}"
nil
end
account_ids = statuses.map(&:account_id)
+10
View File
@@ -66,6 +66,16 @@ class ProcessMentionsService < BaseService
end
def assign_mentions!
# Make sure we never mention blocked accounts
unless @current_mentions.empty?
mentioned_domains = @current_mentions.map { |m| m.account.domain }.compact.uniq
blocked_domains = Set.new(mentioned_domains.empty? ? [] : AccountDomainBlock.where(account_id: @status.account_id, domain: mentioned_domains))
mentioned_account_ids = @current_mentions.map(&:account_id)
blocked_account_ids = Set.new(@status.account.block_relationships.where(target_account_id: mentioned_account_ids).pluck(:target_account_id))
@current_mentions.select! { |mention| !(blocked_account_ids.include?(mention.account_id) || blocked_domains.include?(mention.account.domain)) }
end
@current_mentions.each do |mention|
mention.save if mention.new_record?
end
+4 -4
View File
@@ -19,7 +19,7 @@ class RemoveStatusService < BaseService
@options = options
with_lock("distribute:#{@status.id}") do
@status.discard
@status.discard_with_reblogs
StatusPin.find_by(status: @status)&.destroy
@@ -59,13 +59,13 @@ class RemoveStatusService < BaseService
end
def remove_from_followers
@account.followers_for_local_distribution.reorder(nil).find_each do |follower|
@account.followers_for_local_distribution.includes(:user).reorder(nil).find_each do |follower|
FeedManager.instance.unpush_from_home(follower, @status)
end
end
def remove_from_lists
@account.lists_for_local_distribution.select(:id, :account_id).reorder(nil).find_each do |list|
@account.lists_for_local_distribution.select(:id, :account_id).includes(account: :user).reorder(nil).find_each do |list|
FeedManager.instance.unpush_from_list(list, @status)
end
end
@@ -104,7 +104,7 @@ class RemoveStatusService < BaseService
# because once original status is gone, reblogs will disappear
# without us being able to do all the fancy stuff
@status.reblogs.includes(:account).reorder(nil).find_each do |reblog|
@status.reblogs.rewhere(deleted_at: [nil, @status.deleted_at]).includes(:account).reorder(nil).find_each do |reblog|
RemoveStatusService.new.call(reblog, original_removed: true)
end
end