Settings export refactor (#1646)
* Refactor Export to take an account and know about the export types * Use Export instance in settings/exports#show
This commit is contained in:
parent
faefd8ec8f
commit
0e39cc6a35
8 changed files with 49 additions and 19 deletions
|
@ -6,7 +6,7 @@ module Settings
|
|||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
export_data = Export.new(export_accounts).to_csv
|
||||
@export = Export.new(current_account)
|
||||
|
||||
respond_to do |format|
|
||||
format.csv { send_data export_data, filename: export_filename }
|
||||
|
|
|
@ -5,8 +5,8 @@ module Settings
|
|||
class BlockedAccountsController < BaseController
|
||||
private
|
||||
|
||||
def export_accounts
|
||||
current_account.blocking
|
||||
def export_data
|
||||
@export.to_blocked_accounts_csv
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,8 +5,8 @@ module Settings
|
|||
class FollowingAccountsController < BaseController
|
||||
private
|
||||
|
||||
def export_accounts
|
||||
current_account.following
|
||||
def export_data
|
||||
@export.to_following_accounts_csv
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,8 +5,8 @@ module Settings
|
|||
class MutedAccountsController < BaseController
|
||||
private
|
||||
|
||||
def export_accounts
|
||||
current_account.muting
|
||||
def export_data
|
||||
@export.to_muted_accounts_csv
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,9 +6,6 @@ class Settings::ExportsController < ApplicationController
|
|||
before_action :authenticate_user!
|
||||
|
||||
def show
|
||||
@total_storage = current_account.media_attachments.sum(:file_file_size)
|
||||
@total_follows = current_account.following.count
|
||||
@total_blocks = current_account.blocking.count
|
||||
@total_mutes = current_account.muting.count
|
||||
@export = Export.new(current_account)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue