add ability to export followers
parent
29643fd6c4
commit
0a5eba734e
|
@ -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
|
|
@ -29,6 +29,14 @@ class Export
|
||||||
end
|
end
|
||||||
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
|
def to_lists_csv
|
||||||
CSV.generate do |csv|
|
CSV.generate do |csv|
|
||||||
account.owned_lists.select(:title, :id).each do |list|
|
account.owned_lists.select(:title, :id).each do |list|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
%tr
|
%tr
|
||||||
%th= t('accounts.followers', count: @export.total_followers)
|
%th= t('accounts.followers', count: @export.total_followers)
|
||||||
%td= number_with_delimiter @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
|
%tr
|
||||||
%th= t('exports.blocks')
|
%th= t('exports.blocks')
|
||||||
%td= number_with_delimiter @export.total_blocks
|
%td= number_with_delimiter @export.total_blocks
|
||||||
|
|
|
@ -98,6 +98,7 @@ Rails.application.routes.draw do
|
||||||
resource :export, only: [:show, :create]
|
resource :export, only: [:show, :create]
|
||||||
namespace :exports, constraints: { format: :csv } do
|
namespace :exports, constraints: { format: :csv } do
|
||||||
resources :follows, only: :index, controller: :following_accounts
|
resources :follows, only: :index, controller: :following_accounts
|
||||||
|
resources :followers, only: :index, controller: :followers_accounts
|
||||||
resources :blocks, only: :index, controller: :blocked_accounts
|
resources :blocks, only: :index, controller: :blocked_accounts
|
||||||
resources :mutes, only: :index, controller: :muted_accounts
|
resources :mutes, only: :index, controller: :muted_accounts
|
||||||
resources :lists, only: :index, controller: :lists
|
resources :lists, only: :index, controller: :lists
|
||||||
|
|
Loading…
Reference in New Issue