refactor(note_create): Inbox -> Default naming in functions, parameters and types

This commit is contained in:
Jakob Schlanstedt 2025-11-21 09:48:41 +01:00
parent 7864168adc
commit 71b3ad5027
2 changed files with 12 additions and 12 deletions

View File

@ -26,7 +26,7 @@ export default class Entrypoints extends Component {
async createNoteIntoInboxCommand() { async createNoteIntoInboxCommand() {
await noteCreateService.createNote( await noteCreateService.createNote(
{ target: "inbox" } { target: "default" }
); );
} }

View File

@ -37,7 +37,7 @@ import { CreateNoteAction } from "@triliumnext/commons";
* Hierarchy (general specific): * Hierarchy (general specific):
* - CreateNoteOpts * - CreateNoteOpts
* - CreateNoteWithUrlOpts * - CreateNoteWithUrlOpts
* - CreateNoteIntoInboxOpts * - CreateNoteIntoDefaultOpts
*/ */
/** enforces a truth rule: /** enforces a truth rule:
@ -97,12 +97,12 @@ export type CreateNoteWithUrlOpts =
targetBranchId: string; targetBranchId: string;
}); });
export type CreateNoteIntoInboxOpts = CreateNoteBase & { export type CreateNoteIntoDefaultOpts = CreateNoteBase & {
target: "inbox"; target: "default";
parentNoteUrl?: never; parentNoteUrl?: never;
}; };
export type CreateNoteOpts = CreateNoteWithUrlOpts | CreateNoteIntoInboxOpts; export type CreateNoteOpts = CreateNoteWithUrlOpts | CreateNoteIntoDefaultOpts;
interface Response { interface Response {
// TODO: Deduplicate with server once we have client/server architecture. // TODO: Deduplicate with server once we have client/server architecture.
@ -134,8 +134,8 @@ async function createNote(
switch(resolvedOptions.target) { switch(resolvedOptions.target) {
case "inbox": case "default":
return createNoteIntoInbox(resolvedOptions); return createNoteIntoDefaultLocation(resolvedOptions);
case "into": case "into":
case "before": case "before":
case "after": case "after":
@ -154,7 +154,7 @@ async function createNoteFromAction(
case CreateNoteAction.CreateNote: { case CreateNoteAction.CreateNote: {
const resp = await createNote( const resp = await createNote(
{ {
target: "inbox", target: "default",
title: title, title: title,
activate: true, activate: true,
promptForType: promptForType, promptForType: promptForType,
@ -165,7 +165,7 @@ async function createNoteFromAction(
case CreateNoteAction.CreateAndLinkNote: { case CreateNoteAction.CreateAndLinkNote: {
const resp = await createNote( const resp = await createNote(
{ {
target: "inbox", target: "default",
title, title,
activate: false, activate: false,
promptForType: promptForType, promptForType: promptForType,
@ -329,12 +329,12 @@ async function createNoteWithUrl(
/** /**
* Creates a new note inside the user's Inbox. * Creates a new note inside the user's Inbox.
* *
* @param {CreateNoteIntoInboxOpts} [options] - Optional settings such as title, type, template, or content. * @param {CreateNoteIntoDefaultOpts} [options] - Optional settings such as title, type, template, or content.
* @returns {Promise<{ note: FNote | null; branch: FBranch | undefined }>} * @returns {Promise<{ note: FNote | null; branch: FBranch | undefined }>}
* Resolves with the created note and its branch, or `{ note: null, branch: undefined }` if the inbox is missing. * Resolves with the created note and its branch, or `{ note: null, branch: undefined }` if the inbox is missing.
*/ */
async function createNoteIntoInbox( async function createNoteIntoDefaultLocation(
options: CreateNoteIntoInboxOpts options: CreateNoteIntoDefaultOpts
): Promise<{ note: FNote | null; branch: FBranch | undefined }> { ): Promise<{ note: FNote | null; branch: FBranch | undefined }> {
const inboxNote = await dateNoteService.getInboxNote(); const inboxNote = await dateNoteService.getInboxNote();
if (!inboxNote) { if (!inboxNote) {