Fix ActiveStorage writing to disk
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user