-
Notifications
You must be signed in to change notification settings - Fork 52
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-4719: After import I can no longer add an object to a collection #1989
base: main
Are you sure you want to change the base?
GO-4719: After import I can no longer add an object to a collection #1989
Conversation
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
core/block/export/export.go
Outdated
) | ||
for id, details := range e.docs { | ||
layout := details.GetInt64(bundle.RelationKeyLayout) | ||
if layout == int64(model.ObjectType_collection) { |
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.
These settings could be set for views of sets by relations as well, so check on set layout should be added
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.
And unit test on it
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.
Default object type is only applicable for collection, doesn't it? 🧐
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.
If set is aggregated by relation, then we can choose default object type for views
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
core/block/export/export.go
Outdated
err := cache.Do(e.picker, id, func(sb sb.SmartBlock) error { | ||
st := sb.NewState() | ||
return st.Iterate(func(b simple.Block) (isContinue bool) { | ||
if dv := b.Model().GetDataview(); dv != nil { |
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.
This code could be simplified:
dv := b.Model().GetDataview()
if dv == nil {
return true
}
for ...
return false
core/block/export/export.go
Outdated
@@ -413,6 +420,55 @@ func (e *exportContext) processProtobuf() error { | |||
return nil | |||
} | |||
|
|||
func (e *exportContext) addDependentObjectsFromDataview() error { | |||
var ( | |||
viewDependantObjectsIds []string |
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.
viewDependentObjectsIds 🙃
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.
Thanks, I always make an error in this word 😅
core/block/export/export.go
Outdated
} | ||
} | ||
} | ||
viewDependantObjects, err := e.queryAndFilterObjectsByRelation(e.spaceId, viewDependantObjectsIds, bundle.RelationKeyId) |
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.
viewDependentObjects 🙃
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Add mapping of default object type id to the new one in import, so we get new id of default type in result collection object