Merge branch 'master' into next55

# Conflicts:
#	electron.js
#	package-lock.json
#	package.json
#	src/public/app/layouts/desktop_layout.js
#	src/public/app/widgets/note_tree.js
#	src/services/port.js
This commit is contained in:
zadam
2022-10-15 12:09:25 +02:00
112 changed files with 1817 additions and 418 deletions

View File

@@ -194,10 +194,15 @@ function deleteBranch(req) {
const taskContext = TaskContext.getInstance(req.query.taskId, 'delete-notes');
const deleteId = utils.randomString(10);
const noteDeleted = branch.deleteBranch(deleteId, taskContext);
let noteDeleted;
if (eraseNotes) {
// erase automatically means deleting all clones + note itself
branch.getNote().deleteNote(deleteId, taskContext);
noteService.eraseNotesWithDeleteId(deleteId);
noteDeleted = true;
} else {
noteDeleted = branch.deleteBranch(deleteId, taskContext);
}
if (last) {

View File

@@ -48,7 +48,7 @@ function getNeighbors(note, depth) {
const targetNote = relation.getTargetNote();
if (targetNote.hasLabel('excludeFromNoteMap')) {
if (!targetNote || targetNote.hasLabel('excludeFromNoteMap')) {
continue;
}
@@ -67,7 +67,7 @@ function getNeighbors(note, depth) {
const sourceNote = relation.getNote();
if (sourceNote.hasLabel('excludeFromNoteMap')) {
if (!sourceNote || sourceNote.hasLabel('excludeFromNoteMap')) {
continue;
}
@@ -299,7 +299,7 @@ function getBacklinks(req) {
let backlinksWithExcerptCount = 0;
return backlinks.map(backlink => {
return backlinks.filter(note => !note.getNote().hasLabel('excludeFromNoteMap')).map(backlink => {
const sourceNote = backlink.note;
if (sourceNote.type !== 'text' || backlinksWithExcerptCount > 50) {

View File

@@ -181,6 +181,7 @@ function getRelationMap(req) {
if (def.inverseRelation) {
resp.inverseRelations[relationDefinition.getDefinedName()] = def.inverseRelation;
resp.inverseRelations[def.inverseRelation] = relationDefinition.getDefinedName();
}
}
}
@@ -314,7 +315,7 @@ function getBacklinkCount(req) {
}
else {
return {
count: note.getTargetRelations().length
count: note.getTargetRelations().filter(note => !note.getNote().hasLabel('excludeFromNoteMap')).length
};
}
}

View File

@@ -6,6 +6,7 @@ const log = require('../../services/log');
const scriptService = require('../../services/script');
const searchService = require('../../services/search/services/search');
const bulkActionService = require("../../services/bulk_actions");
const cls = require("../../services/cls");
const {formatAttrForSearch} = require("../../services/attribute_formatter");
function searchFromNoteInt(note) {
@@ -189,7 +190,9 @@ function getRelatedNotes(req) {
}
function searchTemplates() {
const query = formatAttrForSearch({type: 'label', name: "template"}, false);
const query = cls.getHoistedNoteId() === 'root'
? '#template'
: '#template OR #workspaceTemplate';
return searchService.searchNotes(query, {
includeArchivedNotes: true,

View File

@@ -215,7 +215,7 @@ function update(req) {
setInterval(() => {
for (const key in partialRequests) {
if (Date.now() - partialRequests[key].createdAt > 5 * 60 * 1000) {
if (Date.now() - partialRequests[key].createdAt > 20 * 60 * 1000) {
log.info(`Cleaning up unfinished partial requests for ${key}`);
delete partialRequests[key];

View File

@@ -10,7 +10,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
const collectedBranchIds = new Set();
function collectEntityIds(note) {
if (collectedNoteIds.has(note.noteId)) {
if (!note || collectedNoteIds.has(note.noteId)) {
return;
}
@@ -97,6 +97,11 @@ function getNotesAndBranchesAndAttributes(noteIds) {
for (const attributeId of collectedAttributeIds) {
const attribute = becca.attributes[attributeId];
if (!attribute) {
log.error(`Could not find attribute for attributeId=${attributeId}`);
continue;
}
attributes.push({
attributeId: attribute.attributeId,
noteId: attribute.noteId,