blob: ff688978cc3733753ca56793869e10b137a39d2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'csv'
class Settings::ExportsController < ApplicationController
layout 'admin'
before_action :authenticate_user!
before_action :set_account
def show
@total_storage = current_account.media_attachments.sum(:file_file_size)
@total_follows = current_account.following.count
@total_blocks = current_account.blocking.count
end
def download_following_list
@accounts = current_account.following
respond_to do |format|
format.csv { render text: accounts_list_to_csv(@accounts) }
end
end
def download_blocking_list
@accounts = current_account.blocking
respond_to do |format|
format.csv { render text: accounts_list_to_csv(@accounts) }
end
end
private
def set_account
@account = current_user.account
end
def accounts_list_to_csv(list)
CSV.generate do |csv|
list.each do |account|
csv << [(account.local? ? account.local_username_and_domain : account.acct)]
end
end
end
end
|