Fix ActiveStorage writing to disk

This commit is contained in:
Stanko K.R.
2026-02-02 15:16:37 +01:00
parent 96a1d7d2d3
commit 60c63271b9
3 changed files with 29 additions and 2 deletions
@@ -0,0 +1,9 @@
class Account::DataTransfer::ActiveStorageBlobRecordSet < Account::DataTransfer::RecordSet
def initialize(account)
super(
account: account,
model: ActiveStorage::Blob,
attributes: ActiveStorage::Blob.column_names - %w[service_name]
)
end
end
+3 -2
View File
@@ -33,9 +33,10 @@ class Account::DataTransfer::Manifest
::Assignment, ::Tagging, ::Closure, ::Card::Goldness, ::Card::NotNow,
::Card::ActivitySpike, ::Watch, ::Pin, ::Reaction, ::Mention,
::Filter, ::Webhook::DelinquencyTracker, ::Event,
::Notification, ::Notification::Bundle, ::Webhook::Delivery,
::ActiveStorage::Blob, ::ActiveStorage::Attachment
::Notification, ::Notification::Bundle, ::Webhook::Delivery
),
Account::DataTransfer::ActiveStorageBlobRecordSet.new(account),
*build_record_sets(::ActiveStorage::Attachment),
Account::DataTransfer::ActionTextRichTextRecordSet.new(account),
Account::DataTransfer::BlobFileRecordSet.new(account)
]
+17
View File
@@ -40,6 +40,9 @@ class Account::Import < ApplicationRecord
end
end
add_importer_to_all_access_boards
reconcile_account_storage
mark_completed
rescue => e
mark_as_failed
@@ -56,4 +59,18 @@ class Account::Import < ApplicationRecord
failed!
ImportMailer.failed(identity).deliver_later
end
def add_importer_to_all_access_boards
importer = account.users.find_by!(identity: identity)
account.boards.all_access.find_each do |board|
board.accesses.grant_to(importer)
end
end
def reconcile_account_storage
account.boards.each(&:reconcile_storage)
account.reconcile_storage
account.materialize_storage
end
end