about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/exports/followers_accounts_controller.rb19
-rw-r--r--app/models/export.rb8
-rw-r--r--app/views/settings/exports/show.html.haml2
3 files changed, 28 insertions, 1 deletions
diff --git a/app/controllers/settings/exports/followers_accounts_controller.rb b/app/controllers/settings/exports/followers_accounts_controller.rb
new file mode 100644
index 000000000..5ed5d6160
--- /dev/null
+++ b/app/controllers/settings/exports/followers_accounts_controller.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Settings
+  module Exports
+    class FollowersAccountsController < ApplicationController
+      include ExportControllerConcern
+
+      def index
+        send_export_file
+      end
+
+      private
+
+      def export_data
+        @export.to_followers_accounts_csv
+      end
+    end
+  end
+end
diff --git a/app/models/export.rb b/app/models/export.rb
index cab01f11a..fed41310d 100644
--- a/app/models/export.rb
+++ b/app/models/export.rb
@@ -29,6 +29,14 @@ class Export
     end
   end
 
+  def to_followers_accounts_csv
+    CSV.generate(headers: ['Account address'], write_headers: true) do |csv|
+      account.followers.find_each do |follow|
+        csv << [acct(follow)]
+      end
+    end
+  end
+
   def to_lists_csv
     CSV.generate do |csv|
       account.owned_lists.select(:title, :id).each do |list|
diff --git a/app/views/settings/exports/show.html.haml b/app/views/settings/exports/show.html.haml
index b13cea976..455df1c2d 100644
--- a/app/views/settings/exports/show.html.haml
+++ b/app/views/settings/exports/show.html.haml
@@ -23,7 +23,7 @@
       %tr
         %th= t('accounts.followers', count: @export.total_followers)
         %td= number_with_delimiter @export.total_followers
-        %td
+        %td= table_link_to 'download', t('exports.csv'), settings_exports_followers_path(format: :csv)
       %tr
         %th= t('exports.blocks')
         %td= number_with_delimiter @export.total_blocks