From c349ffbfc48bc458b9476a3f4c2213821d4625ba Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Tue, 8 Apr 2025 13:29:06 +0200 Subject: [PATCH] DROID-3438 Widgets | Fix | Add auto-creation flags (#2253) --- .../anytype/middleware/interactor/Middleware.kt | 6 ++++-- .../test/java/com/anytypeio/anytype/MiddlewareTest.kt | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt index 092523a4d9..52e2c0d8e7 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt @@ -822,7 +822,8 @@ class Middleware @Inject constructor( val request = Rpc.File.Upload.Request( localPath = command.path, type = type, - spaceId = command.space.id + spaceId = command.space.id, + createTypeWidgetIfMissing = true ) logRequestIfDebug(request) val (response, time) = measureTimedValue { service.fileUpload(request) } @@ -886,7 +887,8 @@ class Middleware @Inject constructor( templateId = command.template.orEmpty(), internalFlags = command.internalFlags.toMiddlewareModel(), spaceId = command.space.id, - objectTypeUniqueKey = command.typeKey.key + objectTypeUniqueKey = command.typeKey.key, + createTypeWidgetIfMissing = true ) logRequestIfDebug(request) val (response, time) = measureTimedValue { service.objectCreate(request) } diff --git a/middleware/src/test/java/com/anytypeio/anytype/MiddlewareTest.kt b/middleware/src/test/java/com/anytypeio/anytype/MiddlewareTest.kt index 8fa223aa61..106cbc6aae 100644 --- a/middleware/src/test/java/com/anytypeio/anytype/MiddlewareTest.kt +++ b/middleware/src/test/java/com/anytypeio/anytype/MiddlewareTest.kt @@ -534,7 +534,8 @@ class MiddlewareTest { val request = Rpc.File.Upload.Request( localPath = path, type = Block.Content.File.Type.Image, - spaceId = command.space.id + spaceId = command.space.id, + createTypeWidgetIfMissing = true ) service.stub { @@ -565,7 +566,8 @@ class MiddlewareTest { val request = Rpc.File.Upload.Request( localPath = path, type = Block.Content.File.Type.File, - spaceId = command.space.id + spaceId = command.space.id, + createTypeWidgetIfMissing = true ) service.stub { @@ -596,7 +598,8 @@ class MiddlewareTest { val request = Rpc.File.Upload.Request( localPath = path, type = Block.Content.File.Type.Video, - spaceId = command.space.id + spaceId = command.space.id, + createTypeWidgetIfMissing = true ) service.stub {