Commit 9a9ef1cd authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '212457-fix-project-members-streaming-serializer' into 'master'

Add support for project_members array

Closes #212457

See merge request gitlab-org/gitlab!28025
parents a2f1fca6 1e99b7b5
......@@ -48,6 +48,8 @@ module Gitlab
record = exportable.public_send(key) # rubocop: disable GitlabSecurity/PublicSend
if record.is_a?(ActiveRecord::Relation)
serialize_many_relations(key, record, options)
elsif record.respond_to?(:each) # this is to support `project_members` that return an Array
serialize_many_each(key, record, options)
else
serialize_single_relation(key, record, options)
end
......@@ -66,6 +68,14 @@ module Gitlab
json_writer.write_relation_array(@exportable_path, key, enumerator)
end
def serialize_many_each(key, records, options)
records.each do |record|
json = Raw.new(record.to_json(options))
json_writer.append(key, json)
end
end
def serialize_single_relation(key, record, options)
json = Raw.new(record.to_json(options))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment