Commit e5f91e52 authored by James Lopez's avatar James Lopez

refactor code based on feedback

parent 89ca01eb
...@@ -452,7 +452,7 @@ module Ci ...@@ -452,7 +452,7 @@ module Ci
end end
def serializable_hash(options = {}) def serializable_hash(options = {})
super(options.merge(when: read_attribute(:when))) super(options).merge(when: read_attribute(:when))
end end
private private
......
...@@ -53,11 +53,9 @@ module Gitlab ...@@ -53,11 +53,9 @@ module Gitlab
# Finally, it updates each attribute in the newly imported project. # Finally, it updates each attribute in the newly imported project.
def create_relations def create_relations
default_relation_list.each do |relation| default_relation_list.each do |relation|
next unless relation.is_a?(Hash) || @tree_hash[relation.to_s].present?
if relation.is_a?(Hash) if relation.is_a?(Hash)
create_sub_relations(relation, @tree_hash) create_sub_relations(relation, @tree_hash)
else elsif @tree_hash[relation.to_s].present?
relation_key = relation.is_a?(Hash) ? relation.keys.first : relation relation_key = relation.is_a?(Hash) ? relation.keys.first : relation
save_relation_hash(@tree_hash[relation_key.to_s], relation_key) save_relation_hash(@tree_hash[relation_key.to_s], relation_key)
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