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