mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	date note fixes
This commit is contained in:
		| @@ -8,27 +8,21 @@ async function getTodayNote() { | |||||||
|  |  | ||||||
| /** @return {NoteShort} */ | /** @return {NoteShort} */ | ||||||
| async function getDateNote(date) { | async function getDateNote(date) { | ||||||
|     const note = await server.get('date-notes/date/' + date); |     const note = await server.get('date-notes/date/' + date, {'trilium-source-id': "date-note"}); | ||||||
|  |  | ||||||
|     await treeCache.reloadNotes([note.noteId]); |  | ||||||
|  |  | ||||||
|     return await treeCache.getNote(note.noteId); |     return await treeCache.getNote(note.noteId); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** @return {NoteShort} */ | /** @return {NoteShort} */ | ||||||
| async function getMonthNote(month) { | async function getMonthNote(month) { | ||||||
|     const note = await server.get('date-notes/month/' + month); |     const note = await server.get('date-notes/month/' + month, {'trilium-source-id': "date-note"}); | ||||||
|  |  | ||||||
|     await treeCache.reloadNotes([note.noteId]); |  | ||||||
|  |  | ||||||
|     return await treeCache.getNote(note.noteId); |     return await treeCache.getNote(note.noteId); | ||||||
| } | } | ||||||
|  |  | ||||||
| /** @return {NoteShort} */ | /** @return {NoteShort} */ | ||||||
| async function getYearNote(year) { | async function getYearNote(year) { | ||||||
|     const note = await server.get('date-notes/year/' + year); |     const note = await server.get('date-notes/year/' + year, {'trilium-source-id': "date-note"}); | ||||||
|  |  | ||||||
|     await treeCache.reloadNotes([note.noteId]); |  | ||||||
|  |  | ||||||
|     return await treeCache.getNote(note.noteId); |     return await treeCache.getNote(note.noteId); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -64,15 +64,15 @@ async function call(method, url, data, headers = {}) { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         return await ajax(url, method, data); |         return await ajax(url, method, data, headers); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| async function ajax(url, method, data) { | async function ajax(url, method, data, headers) { | ||||||
|     const options = { |     const options = { | ||||||
|         url: baseApiUrl + url, |         url: baseApiUrl + url, | ||||||
|         type: method, |         type: method, | ||||||
|         headers: getHeaders(), |         headers: getHeaders(headers), | ||||||
|         timeout: 60000 |         timeout: 60000 | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -55,8 +55,6 @@ class TreeCache { | |||||||
|                     if (childNote) { |                     if (childNote) { | ||||||
|                         childNote.parents = childNote.parents.filter(p => p !== noteId); |                         childNote.parents = childNote.parents.filter(p => p !== noteId); | ||||||
|  |  | ||||||
|                         console.log("Cleaning up", childNote.parentToBranch[noteId]); |  | ||||||
|  |  | ||||||
|                         delete this.branches[childNote.parentToBranch[noteId]]; |                         delete this.branches[childNote.parentToBranch[noteId]]; | ||||||
|                         delete childNote.parentToBranch[noteId]; |                         delete childNote.parentToBranch[noteId]; | ||||||
|                     } |                     } | ||||||
| @@ -75,10 +73,6 @@ class TreeCache { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             for (const branch of branchesByNotes[noteId] || []) { // can be empty for deleted notes |             for (const branch of branchesByNotes[noteId] || []) { // can be empty for deleted notes | ||||||
|                 if (noteId === '2Ndfjyv3EbEQ') { |  | ||||||
|                     console.log("Adding", branch.branchId); |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 this.branches[branch.branchId] = branch; |                 this.branches[branch.branchId] = branch; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ const syncOptions = require('./sync_options'); | |||||||
| const syncMutexService = require('./sync_mutex'); | const syncMutexService = require('./sync_mutex'); | ||||||
| const cls = require('./cls'); | const cls = require('./cls'); | ||||||
| const request = require('./request'); | const request = require('./request'); | ||||||
|  | const ws = require('./ws'); | ||||||
|  |  | ||||||
| let proxyToggle = true; | let proxyToggle = true; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user