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

- `app/views/statuses/_simple_status.html.haml`:
  Small markup change in glitch-soc, on a line that has been modified by
  upstream. Ported upstream changes.
This commit is contained in:
Claire
2021-05-07 18:21:59 +02:00
483 changed files with 13397 additions and 7694 deletions

View File

@ -35,7 +35,7 @@ class ActivityPub::DistributionWorker
# Deliver the status to all followers.
# If the status is a reply to another local status, also forward it to that
# status' authors' followers.
@inboxes ||= if @status.reply? && @status.thread.account.local? && @status.distributable?
@inboxes ||= if @status.in_reply_to_local_account? && @status.distributable?
@account.followers.or(@status.thread.account.followers).inboxes
else
@account.followers.inboxes

View File

@ -5,7 +5,7 @@ class Import::RelationshipWorker
sidekiq_options queue: 'pull', retry: 8, dead: false
def perform(account_id, target_account_uri, relationship, options = {})
def perform(account_id, target_account_uri, relationship, options)
from_account = Account.find(account_id)
target_domain = domain(target_account_uri)
target_account = stoplight_wrap_request(target_domain) { ResolveAccountService.new.call(target_account_uri, { check_delivery_availability: true }) }
@ -16,7 +16,7 @@ class Import::RelationshipWorker
case relationship
when 'follow'
begin
FollowService.new.call(from_account, target_account, options)
FollowService.new.call(from_account, target_account, **options)
rescue ActiveRecord::RecordInvalid
raise if FollowLimitValidator.limit_for_account(from_account) < from_account.following_count
end
@ -27,7 +27,7 @@ class Import::RelationshipWorker
when 'unblock'
UnblockService.new.call(from_account, target_account)
when 'mute'
MuteService.new.call(from_account, target_account, options)
MuteService.new.call(from_account, target_account, **options)
when 'unmute'
UnmuteService.new.call(from_account, target_account)
end

View File

@ -3,11 +3,11 @@
class MergeWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull'
def perform(from_account_id, into_account_id)
FeedManager.instance.merge_into_home(Account.find(from_account_id), Account.find(into_account_id))
rescue ActiveRecord::RecordNotFound
true
ensure
Redis.current.del("account:#{into_account_id}:regeneration")
end
end

View File

@ -3,6 +3,7 @@
class RedownloadMediaWorker
include Sidekiq::Worker
include ExponentialBackoff
include JsonLdHelper
sidekiq_options queue: 'pull', retry: 3
@ -15,6 +16,14 @@ class RedownloadMediaWorker
media_attachment.download_thumbnail!
media_attachment.save
rescue ActiveRecord::RecordNotFound
true
# Do nothing
rescue Mastodon::UnexpectedResponseError => e
response = e.response
if response_error_unsalvageable?(response)
# Give up
else
raise e
end
end
end

View File

@ -14,13 +14,14 @@ class Scheduler::FollowRecommendationsScheduler
def perform
# Maintaining a materialized view speeds-up subsequent queries significantly
AccountSummary.refresh
FollowRecommendation.refresh
fallback_recommendations = FollowRecommendation.safe.filtered.limit(SET_SIZE).index_by(&:account_id)
fallback_recommendations = FollowRecommendation.limit(SET_SIZE).index_by(&:account_id)
I18n.available_locales.each do |locale|
recommendations = begin
if AccountSummary.safe.filtered.localized(locale).exists? # We can skip the work if no accounts with that language exist
FollowRecommendation.safe.filtered.localized(locale).limit(SET_SIZE).index_by(&:account_id)
FollowRecommendation.localized(locale).limit(SET_SIZE).index_by(&:account_id)
else
{}
end

View File

@ -14,5 +14,7 @@ class ThreadResolveWorker
child_status.thread = parent_status
child_status.save!
rescue ActiveRecord::RecordNotFound
true
end
end