Skip to content

Commit

Permalink
Merge pull request #1428 from anyproto/go-3770-deleted-type-on-initia…
Browse files Browse the repository at this point in the history
…l-empty-space-homepage

GO-3770: Hot fix for type import
  • Loading branch information
deff7 authored Jul 29, 2024
2 parents 55c13f9 + 716fb18 commit d8599a6
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 d8599a6

Please sign in to comment.