Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/import_export/log_util.rb')
-rw-r--r--lib/gitlab/import_export/log_util.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/log_util.rb b/lib/gitlab/import_export/log_util.rb
new file mode 100644
index 00000000000..d3a3dce47ba
--- /dev/null
+++ b/lib/gitlab/import_export/log_util.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module ImportExport
+ class LogUtil
+ def self.exportable_to_log_payload(exportable)
+ attribute_base_name = exportable.class.name.underscore
+
+ return {} unless %w[project group].include?(attribute_base_name)
+
+ {}.tap do |log|
+ log[:"#{attribute_base_name}_id"] = exportable.id
+ log[:"#{attribute_base_name}_name"] = exportable.name
+ log[:"#{attribute_base_name}_path"] = exportable.full_path
+ end.compact
+ end
+ end
+ end
+end