mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
moving from inherited attribute queries to owned one where it makes sense
This commit is contained in:
@@ -15,7 +15,7 @@ async function findClippingNote(todayNote, pageUrl) {
|
||||
const notes = await todayNote.getDescendantNotesWithLabel('pageUrl', pageUrl);
|
||||
|
||||
for (const note of notes) {
|
||||
if (await note.getLabelValue('clipType') === 'clippings') {
|
||||
if (await note.getOwnedLabelValue('clipType') === 'clippings') {
|
||||
return note;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,31 +27,6 @@ async function getNote(req) {
|
||||
return note;
|
||||
}
|
||||
|
||||
async function getChildren(req) {
|
||||
const parentNoteId = req.params.parentNoteId;
|
||||
const parentNote = await repository.getNote(parentNoteId);
|
||||
|
||||
if (!parentNote) {
|
||||
return [404, `Note ${parentNoteId} has not been found.`];
|
||||
}
|
||||
|
||||
const ret = [];
|
||||
|
||||
for (const childNote of await parentNote.getChildNotes()) {
|
||||
ret.push({
|
||||
noteId: childNote.noteId,
|
||||
title: childNote.title,
|
||||
relations: (await childNote.getRelations()).map(relation => { return {
|
||||
attributeId: relation.attributeId,
|
||||
name: relation.name,
|
||||
targetNoteId: relation.value
|
||||
}; })
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
async function createNote(req) {
|
||||
const params = Object.assign({}, req.body); // clone
|
||||
params.parentNoteId = req.params.parentNoteId;
|
||||
@@ -198,7 +173,6 @@ module.exports = {
|
||||
sortNotes,
|
||||
protectSubtree,
|
||||
setNoteTypeMime,
|
||||
getChildren,
|
||||
getRelationMap,
|
||||
changeTitle,
|
||||
duplicateNote
|
||||
|
||||
@@ -90,7 +90,7 @@ async function getUserThemes() {
|
||||
const ret = [];
|
||||
|
||||
for (const note of notes) {
|
||||
let value = await note.getLabelValue('appTheme');
|
||||
let value = await note.getOwnedLabelValue('appTheme');
|
||||
|
||||
if (!value) {
|
||||
value = note.title.toLowerCase().replace(/[^a-z0-9]/gi, '-');
|
||||
|
||||
Reference in New Issue
Block a user