date note fixes

This commit is contained in:
zadam 2019-10-27 22:13:38 +01:00
parent e04845335b
commit b7344329f4
4 changed files with 7 additions and 18 deletions

View File

@ -8,27 +8,21 @@ async function getTodayNote() {
/** @return {NoteShort} */
async function getDateNote(date) {
const note = await server.get('date-notes/date/' + date);
await treeCache.reloadNotes([note.noteId]);
const note = await server.get('date-notes/date/' + date, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}
/** @return {NoteShort} */
async function getMonthNote(month) {
const note = await server.get('date-notes/month/' + month);
await treeCache.reloadNotes([note.noteId]);
const note = await server.get('date-notes/month/' + month, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}
/** @return {NoteShort} */
async function getYearNote(year) {
const note = await server.get('date-notes/year/' + year);
await treeCache.reloadNotes([note.noteId]);
const note = await server.get('date-notes/year/' + year, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}

View File

@ -64,15 +64,15 @@ async function call(method, url, data, headers = {}) {
});
}
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 = {
url: baseApiUrl + url,
type: method,
headers: getHeaders(),
headers: getHeaders(headers),
timeout: 60000
};

View File

@ -55,8 +55,6 @@ class TreeCache {
if (childNote) {
childNote.parents = childNote.parents.filter(p => p !== noteId);
console.log("Cleaning up", childNote.parentToBranch[noteId]);
delete this.branches[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
if (noteId === '2Ndfjyv3EbEQ') {
console.log("Adding", branch.branchId);
}
this.branches[branch.branchId] = branch;
}

View File

@ -14,6 +14,7 @@ const syncOptions = require('./sync_options');
const syncMutexService = require('./sync_mutex');
const cls = require('./cls');
const request = require('./request');
const ws = require('./ws');
let proxyToggle = true;