BigW Consortium Gitlab

Commit de6c44e9 by James Lopez

using new config

parent acfa0b69
...@@ -11,27 +11,11 @@ module Projects ...@@ -11,27 +11,11 @@ module Projects
end end
def project_tree def project_tree
%i(issues labels milestones releases events) + [snippets, members, merge_requests, commit_statuses] Projects::ImportExport::ImportExportReader.project_tree
end end
private private
def snippets
{ snippets: { except: :expired_at } }
end
def merge_requests
{ merge_requests: { include: :merge_request_diff } }
end
def commit_statuses
{ commit_statuses: { include: :commit } }
end
def members
{ project_members: { include: [user: { only: [:id, :email, :username] }] } }
end
def storage_path def storage_path
File.join(Settings.shared['path'], 'tmp/project_exports') File.join(Settings.shared['path'], 'tmp/project_exports')
end end
......
...@@ -28,4 +28,8 @@ ...@@ -28,4 +28,8 @@
:user: :user:
- :id - :id
- :email - :email
- :username - :username
\ No newline at end of file
:attributes_except:
:snippets:
- :expired_at
\ No newline at end of file
...@@ -26,7 +26,14 @@ module Projects ...@@ -26,7 +26,14 @@ module Projects
end end
def build_hash(array) def build_hash(array)
array.map { |el| el.is_a?(Hash) ? process_include(el) : el } array.map do |el|
if el.is_a?(Hash)
process_include(el)
else
only_except_hash = check_only_and_except(el)
only_except_hash.empty? ? el : { el => only_except_hash }
end
end
end end
def process_include(hash, included_classes_hash = {}) def process_include(hash, included_classes_hash = {})
...@@ -44,8 +51,8 @@ module Projects ...@@ -44,8 +51,8 @@ module Projects
def process_current_class(hash, included_classes_hash, value) def process_current_class(hash, included_classes_hash, value)
value = value.is_a?(Hash) ? process_include(hash, included_classes_hash) : value value = value.is_a?(Hash) ? process_include(hash, included_classes_hash) : value
current_key = hash.keys.first current_key = hash.keys.first
current_key_only = check_only_and_except(current_key) only_except_hash = check_only_and_except(current_key)
included_classes_hash[current_key] ||= current_key_only unless current_key_only.empty? included_classes_hash[current_key] ||= only_except_hash unless only_except_hash.empty?
return current_key, value return current_key, value
end end
...@@ -56,8 +63,8 @@ module Projects ...@@ -56,8 +63,8 @@ module Projects
end end
def add_class(current_key, included_classes_hash, value) def add_class(current_key, included_classes_hash, value)
check_only_hash = check_only_and_except(value) only_except_hash = check_only_and_except(value)
value = { value => check_only_hash } unless check_only_hash.empty? value = { value => only_except_hash } unless only_except_hash.empty?
old_values = included_classes_hash[current_key][:include] old_values = included_classes_hash[current_key][:include]
included_classes_hash[current_key][:include] = ([old_values] + [value]).compact.flatten included_classes_hash[current_key][:include] = ([old_values] + [value]).compact.flatten
end end
......
...@@ -32,7 +32,7 @@ module Projects ...@@ -32,7 +32,7 @@ module Projects
def project_json_tree def project_json_tree
# TODO confirm children, also add subchildren (i.e comments) # TODO confirm children, also add subchildren (i.e comments)
# TODO confirm atts for children # TODO confirm atts for children
@project.to_json(only: ImportExport.project_atts, include: ImportExport.project_tree) @project.to_json(Projects::ImportExport.project_tree)
end end
end end
end end
......
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