fix broken what links here widget

This commit is contained in:
zadam 2020-09-05 22:45:26 +02:00
parent 6d095b7250
commit 874972a3d3
4 changed files with 15 additions and 3 deletions

View File

@ -481,6 +481,17 @@ class NoteShort {
.map(attributeId => this.treeCache.attributes[attributeId]); .map(attributeId => this.treeCache.attributes[attributeId]);
} }
/**
* Get relations which target this note
*
* @returns {NoteShort[]}
*/
async getTargetRelationSourceNotes() {
const targetRelations = this.getTargetRelations();
return await this.treeCache.getNotes(targetRelations.map(tr => tr.noteId));
}
/** /**
* Return note complement which is most importantly note's content * Return note complement which is most importantly note's content
* *

View File

@ -141,7 +141,7 @@ class TreeCache {
const note = this.notes[attributeRow.noteId]; const note = this.notes[attributeRow.noteId];
if (!note.attributes.includes(attributeId)) { if (note && !note.attributes.includes(attributeId)) {
note.attributes.push(attributeId); note.attributes.push(attributeId);
} }

View File

@ -38,7 +38,8 @@ function getNotesAndBranchesAndAttributes(noteIds) {
position, position,
isInheritable isInheritable
FROM attributes FROM attributes
WHERE isDeleted = 0 AND noteId IN (???)`, noteIds); WHERE isDeleted = 0
AND (noteId IN (???) OR (type = 'relation' AND value IN (???)))`, noteIds);
// sorting in memory is faster // sorting in memory is faster
attributes.sort((a, b) => a.position - b.position < 0 ? -1 : 1); attributes.sort((a, b) => a.position - b.position < 0 ? -1 : 1);