Skip to content

Commit

Permalink
GO-3770: Hot fix for type import
Browse files Browse the repository at this point in the history
  • Loading branch information
deff7 committed Jul 29, 2024
1 parent 55c13f9 commit 716fb18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/block/import/common/objectid/derivedobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (d *derivedObject) GetIDAndPayload(ctx context.Context, spaceID string, sn
}

var key string
if d.isDeletedObject(uniqueKey.Marshal()) {
if d.isDeletedObject(spaceID, uniqueKey.Marshal()) {
key = bson.NewObjectId().Hex()
uniqueKey, err = domain.NewUniqueKey(sn.SbType, key)
if err != nil {
Expand All @@ -74,9 +74,14 @@ func (d *derivedObject) GetInternalKey(sbType sb.SmartBlockType) string {
return d.internalKey
}

func (d *derivedObject) isDeletedObject(uniqueKey string) bool {
func (d *derivedObject) isDeletedObject(spaceId string, uniqueKey string) bool {
ids, _, err := d.objectStore.QueryObjectIDs(database.Query{
Filters: []*model.BlockContentDataviewFilter{
{
Condition: model.BlockContentDataviewFilter_Equal,
RelationKey: bundle.RelationKeySpaceId.String(),
Value: pbtypes.String(spaceId),
},
{
Condition: model.BlockContentDataviewFilter_Equal,
RelationKey: bundle.RelationKeyUniqueKey.String(),
Expand Down

0 comments on commit 716fb18

Please sign in to comment.