DROID-2144 Object | Fix | Use default object type or fallback to 'Note' type when creating object from clipboard in the new any-object-creation panel (#790)
This commit is contained in:
parent
05fcf8aebb
commit
04af82dc74
|
@ -22,7 +22,7 @@ class CreatePrefilledNote @Inject constructor(
|
|||
override suspend fun doWork(params: Params): Id {
|
||||
val obj = repo.createObject(
|
||||
Command.CreateObject(
|
||||
typeKey = TypeKey(ObjectTypeUniqueKeys.NOTE),
|
||||
typeKey = params.customType ?: TypeKey(ObjectTypeUniqueKeys.NOTE),
|
||||
space = SpaceId(params.space),
|
||||
template = null,
|
||||
internalFlags = emptyList(),
|
||||
|
@ -43,9 +43,13 @@ class CreatePrefilledNote @Inject constructor(
|
|||
return obj.id
|
||||
}
|
||||
|
||||
/**
|
||||
* @param [customType] provide custom type instead of note if needed
|
||||
*/
|
||||
data class Params(
|
||||
val space: Id,
|
||||
val text: String,
|
||||
val details: Struct
|
||||
val details: Struct,
|
||||
val customType: TypeKey? = null
|
||||
)
|
||||
}
|
|
@ -475,6 +475,12 @@ class SelectObjectTypeViewModel(
|
|||
private fun proceedWithCreatingNote(text: String) {
|
||||
viewModelScope.launch {
|
||||
val startTime = System.currentTimeMillis()
|
||||
val defaultObjectType = getDefaultObjectType.async(Unit).getOrNull()?.type?.let {
|
||||
if (it.key != ObjectTypeUniqueKeys.COLLECTION && it.key != ObjectTypeUniqueKeys.SET)
|
||||
it
|
||||
else
|
||||
null
|
||||
}
|
||||
createPrefilledNote.async(
|
||||
CreatePrefilledNote.Params(
|
||||
text = text,
|
||||
|
|
Loading…
Reference in New Issue
Block a user