mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	server-ts: Fix "Missing or incorrect type for target branch ID"
When attempting to add a new note from the relation map
This commit is contained in:
		
							parent
							
								
									b50ceaf299
								
							
						
					
					
						commit
						4ab6f159e5
					
				| @ -43,7 +43,7 @@ function createNote(req: Request) { | ||||
|         throw new ValidationError("Invalid target type."); | ||||
|     } | ||||
| 
 | ||||
|     if (typeof targetBranchId !== "string") { | ||||
|     if (targetBranchId && typeof targetBranchId !== "string") { | ||||
|         throw new ValidationError("Missing or incorrect type for target branch ID."); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -251,7 +251,7 @@ function createNewNote(params: NoteParams): { | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| function createNewNoteWithTarget(target: ("into" | "after"), targetBranchId: string, params: NoteParams) { | ||||
| function createNewNoteWithTarget(target: ("into" | "after"), targetBranchId: string | undefined, params: NoteParams) { | ||||
|     if (!params.type) { | ||||
|         const parentNote = becca.notes[params.parentNoteId]; | ||||
| 
 | ||||
| @ -263,7 +263,7 @@ function createNewNoteWithTarget(target: ("into" | "after"), targetBranchId: str | ||||
|     if (target === 'into') { | ||||
|         return createNewNote(params); | ||||
|     } | ||||
|     else if (target === 'after') { | ||||
|     else if (target === 'after' && targetBranchId) { | ||||
|         const afterBranch = becca.branches[targetBranchId]; | ||||
| 
 | ||||
|         // not updating utcDateModified to avoid having to sync whole rows
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran