2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-26 15:29:36 -05:00
|
|
|
require "import_export/base_exporter"
|
2016-01-25 12:37:43 -06:00
|
|
|
|
2017-10-26 15:29:36 -05:00
|
|
|
module ImportExport
|
|
|
|
class TopicExporter < ImportExport::BaseExporter
|
2016-01-25 12:37:43 -06:00
|
|
|
def initialize(topic_ids)
|
2017-10-26 15:29:36 -05:00
|
|
|
@topics = Topic.where(id: topic_ids).to_a
|
2016-01-25 12:37:43 -06:00
|
|
|
@export_data = { topics: [], users: [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def perform
|
2017-10-26 15:29:36 -05:00
|
|
|
export_topics!
|
|
|
|
export_topic_users!
|
2016-01-25 12:37:43 -06:00
|
|
|
# TODO: user actions
|
|
|
|
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2017-10-26 15:29:36 -05:00
|
|
|
def default_filename_prefix
|
|
|
|
"topic-export"
|
2016-01-25 12:37:43 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|