-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GO-4346: After exporting Templates, they become unlinked #1993
base: main
Are you sure you want to change the base?
GO-4346: After exporting Templates, they become unlinked #1993
Conversation
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
core/block/export/export.go
Outdated
objectsTypes = lo.Union(objectsTypes, []string{objectTypeId}) | ||
setOfList := details.GetStringList(bundle.RelationKeySetOf) | ||
setOf = lo.Union(setOf, setOfList) | ||
targetObjectType := details.GetString(bundle.RelationKeyTargetObjectType) | ||
if targetObjectType != "" { | ||
objectsTypes = lo.Union(objectsTypes, []string{targetObjectType}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this code could be made more elegant, if we present for-cycle by relation keys SetOf, Type and TargetObjectType. In the iteration-body we can try to GetString first and then GetStringList. Or maybe GetStringList is a fallback for these two methods. Need to consult @deff7 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but setOf
is added to another slice, so I think it makes sense to create such for-cycle for targetObjectType
and objectType
values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is better to introduce inner field(s) to exportContext struct, so there would be no necessity to return values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Extract object id from
TargetObjectType
relation in case it is present in object and add to result export archive, so in case of pb import we also import template object type.