diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-04-13 07:02:02 -0400 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-13 13:02:02 +0200 |
commit | 0e39cc6a35661416a1f1ccb8841863f7bf307020 (patch) | |
tree | 7905b859d61ff98ca63a66eb86c50da4834e9c89 /app/controllers/settings | |
parent | faefd8ec8f164e174fd887f06d01c7fe8ed05531 (diff) |
Settings export refactor (#1646)
* Refactor Export to take an account and know about the export types * Use Export instance in settings/exports#show
Diffstat (limited to 'app/controllers/settings')
5 files changed, 8 insertions, 11 deletions
diff --git a/app/controllers/settings/exports/base_controller.rb b/app/controllers/settings/exports/base_controller.rb index 0b790959f..c082ed806 100644 --- a/app/controllers/settings/exports/base_controller.rb +++ b/app/controllers/settings/exports/base_controller.rb @@ -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 } diff --git a/app/controllers/settings/exports/blocked_accounts_controller.rb b/app/controllers/settings/exports/blocked_accounts_controller.rb index 9c4bcaa53..f1115b21e 100644 --- a/app/controllers/settings/exports/blocked_accounts_controller.rb +++ b/app/controllers/settings/exports/blocked_accounts_controller.rb @@ -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 diff --git a/app/controllers/settings/exports/following_accounts_controller.rb b/app/controllers/settings/exports/following_accounts_controller.rb index 8d06bcc95..0011d2463 100644 --- a/app/controllers/settings/exports/following_accounts_controller.rb +++ b/app/controllers/settings/exports/following_accounts_controller.rb @@ -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 diff --git a/app/controllers/settings/exports/muted_accounts_controller.rb b/app/controllers/settings/exports/muted_accounts_controller.rb index a77a9af6d..dfe72cfcb 100644 --- a/app/controllers/settings/exports/muted_accounts_controller.rb +++ b/app/controllers/settings/exports/muted_accounts_controller.rb @@ -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 diff --git a/app/controllers/settings/exports_controller.rb b/app/controllers/settings/exports_controller.rb index 77dea3231..ae62f00c1 100644 --- a/app/controllers/settings/exports_controller.rb +++ b/app/controllers/settings/exports_controller.rb @@ -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 |