Merge commit 'c26003af215da7696e2b0dcece7fa695b1be8871' into glitch-soc/merge-upstream
This commit is contained in:
commit
42ec9a607b
157 files changed
+1064
-1429
No files matched your search
+13
-1
@@ -268,7 +268,19 @@ class Account < ApplicationRecord
|
||||
def needs_background_refresh?
|
||||
return false if local?
|
||||
|
||||
last_webfingered_at.blank? || last_webfingered_at <= BACKGROUND_REFRESH_INTERVAL.ago
|
||||
return true if last_webfingered_at.blank? || last_webfingered_at <= BACKGROUND_REFRESH_INTERVAL.ago
|
||||
|
||||
# TODO: Remove some time after 4.6
|
||||
# This is temporary workaround to speed up account refreshs after
|
||||
# collections have been enabled / deployed.
|
||||
# Accounts will be refreshed when they lack a feature_approval_policy
|
||||
# but we know from other account's on the same server that they should
|
||||
# have.
|
||||
return false unless feature_approval_policy.zero?
|
||||
|
||||
Rails.cache.fetch("feature_approval_policy_availability:#{domain}", expires_in: 30.minutes) do
|
||||
Account.where(domain:).where.not(feature_approval_policy: 0).exists?
|
||||
end
|
||||
end
|
||||
|
||||
def schedule_refresh_if_stale!
|
||||
|
||||
@@ -13,7 +13,12 @@ class Admin::CollectionBatchAction < Admin::BaseAction
|
||||
def process_action!
|
||||
return unless collection_ids
|
||||
|
||||
add_to_report!
|
||||
case type
|
||||
when 'report'
|
||||
add_to_report!
|
||||
when 'remove_from_report'
|
||||
handle_remove_from_report!
|
||||
end
|
||||
end
|
||||
|
||||
def add_to_report!
|
||||
@@ -24,6 +29,13 @@ class Admin::CollectionBatchAction < Admin::BaseAction
|
||||
@report_id = @report.id
|
||||
end
|
||||
|
||||
def handle_remove_from_report!
|
||||
return unless with_report?
|
||||
|
||||
@report.collections = (@report.collections - selected_collections)
|
||||
@report.save!
|
||||
end
|
||||
|
||||
def selected_collections
|
||||
@report.target_account.collections.where(id: collection_ids)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user