Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AnastasiaShemyakinskaya
Copy link
Member

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.

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
@AnastasiaShemyakinskaya AnastasiaShemyakinskaya changed the title GO-4346: fix template export GO-4346: After exporting Templates, they become unlinked Jan 7, 2025
Copy link

github-actions bot commented Jan 7, 2025

New Coverage 50.4% of statements
Patch Coverage 87.3% of changed statements (55/63)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

Comment on lines 496 to 502
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})
}
Copy link
Member

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 🙂

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants