refactor: importer

This commit is contained in:
Aman Harwara
2023-12-07 21:29:00 +05:30
parent 2cc2dddb9b
commit 620cd960e2
9 changed files with 14 additions and 13 deletions

View File

@@ -98,6 +98,7 @@ export class Importer {
trashed,
archived,
pinned,
useSuperIfPossible,
}) => {
if (noteType === NoteType.Super && !this.isEntitledToSuper()) {
noteType = undefined
@@ -111,6 +112,8 @@ export class Importer {
editorIdentifier = undefined
}
const shouldUseSuper = useSuperIfPossible && this.isEntitledToSuper()
return {
created_at: createdAt,
created_at_timestamp: createdAt.getTime(),
@@ -122,11 +125,11 @@ export class Importer {
title,
text,
references: [],
noteType,
noteType: shouldUseSuper ? NoteType.Super : noteType,
trashed,
archived,
pinned,
editorIdentifier,
editorIdentifier: shouldUseSuper ? NativeFeatureIdentifier.TYPES.SuperEditor : editorIdentifier,
},
}
}