mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
39 lines
895 B
Ruby
39 lines
895 B
Ruby
# frozen_string_literal: true
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: bulk_import_rows
|
|
#
|
|
# id :bigint(8) not null, primary key
|
|
# bulk_import_id :bigint(8) not null
|
|
# data :jsonb
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
class BulkImportRow < ApplicationRecord
|
|
belongs_to :bulk_import
|
|
|
|
def to_csv
|
|
case bulk_import.type.to_sym
|
|
when :following
|
|
[data['acct'], data.fetch('show_reblogs', true), data.fetch('notify', false), language_list]
|
|
when :blocking
|
|
[data['acct']]
|
|
when :muting
|
|
[data['acct'], data.fetch('hide_notifications', true)]
|
|
when :domain_blocking
|
|
[data['domain']]
|
|
when :bookmarks
|
|
[data['uri']]
|
|
when :lists
|
|
[data['list_name'], data['acct']]
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def language_list
|
|
data['languages']&.join(', ')
|
|
end
|
|
end
|