mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
moving from inherited attribute queries to owned one where it makes sense
This commit is contained in:
@@ -81,7 +81,7 @@ async function getYearNote(dateStr, rootNote) {
|
||||
}
|
||||
|
||||
async function getMonthNoteTitle(rootNote, monthNumber, dateObj) {
|
||||
const pattern = await rootNote.getLabelValue("monthPattern") || "{monthNumberPadded} - {month}";
|
||||
const pattern = await rootNote.getOwnedLabelValue("monthPattern") || "{monthNumberPadded} - {month}";
|
||||
const monthName = MONTHS[dateObj.getMonth()];
|
||||
|
||||
return pattern
|
||||
@@ -127,7 +127,7 @@ async function getMonthNote(dateStr, rootNote) {
|
||||
}
|
||||
|
||||
async function getDateNoteTitle(rootNote, dayNumber, dateObj) {
|
||||
const pattern = await rootNote.getLabelValue("datePattern") || "{dayInMonthPadded} - {weekDay}";
|
||||
const pattern = await rootNote.getOwnedLabelValue("datePattern") || "{dayInMonthPadded} - {weekDay}";
|
||||
const weekDay = DAYS[dateObj.getDay()];
|
||||
|
||||
return pattern
|
||||
|
||||
@@ -16,7 +16,7 @@ async function exportToOpml(taskContext, branch, version, res) {
|
||||
const branch = await repository.getBranch(branchId);
|
||||
const note = await branch.getNote();
|
||||
|
||||
if (!note.isStringNote() || await note.hasLabel('excludeFromExport')) {
|
||||
if (!note.isStringNote() || await note.hasOwnedLabel('excludeFromExport')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ async function exportToTar(taskContext, branch, format, res) {
|
||||
async function getNoteMeta(branch, parentMeta, existingFileNames) {
|
||||
const note = await branch.getNote();
|
||||
|
||||
if (await note.hasLabel('excludeFromExport')) {
|
||||
if (await note.hasOwnedLabel('excludeFromExport')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ eventService.subscribe(eventService.NOTE_TITLE_CHANGED, async note => {
|
||||
const parents = await note.getParentNotes();
|
||||
|
||||
for (const parent of parents) {
|
||||
if (await parent.hasLabel("sorted")) {
|
||||
if (await parent.hasOwnedLabel("sorted")) {
|
||||
await treeService.sortNotesAlphabetically(parent.noteId);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ eventService.subscribe(eventService.ENTITY_CHANGED, async ({ entityName, entity
|
||||
eventService.subscribe(eventService.ENTITY_DELETED, async ({ entityName, entity }) => {
|
||||
await processInverseRelations(entityName, entity, async (definition, note, targetNote) => {
|
||||
// if one inverse attribute is deleted then the other should be deleted as well
|
||||
const relations = await targetNote.getRelations(definition.inverseRelation);
|
||||
const relations = await targetNote.getOwnedRelations(definition.inverseRelation);
|
||||
let deletedSomething = false;
|
||||
|
||||
for (const relation of relations) {
|
||||
|
||||
@@ -40,7 +40,7 @@ async function executeBundle(bundle, apiParams = {}) {
|
||||
const ctx = new ScriptContext(bundle.allNotes, apiParams);
|
||||
|
||||
try {
|
||||
if (await bundle.note.hasLabel('manualTransactionHandling')) {
|
||||
if (await bundle.note.hasOwnedLabel('manualTransactionHandling')) {
|
||||
return await execute(ctx, script);
|
||||
}
|
||||
else {
|
||||
@@ -117,7 +117,7 @@ async function getScriptBundle(note, root = true, scriptEnv = null, includedNote
|
||||
return;
|
||||
}
|
||||
|
||||
if (!root && await note.hasLabel('disableInclusion')) {
|
||||
if (!root && await note.hasOwnedLabel('disableInclusion')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user