Only top-level notes are displayed in journal

This commit is contained in:
ThaumRystra
2023-09-13 10:05:45 +02:00
parent 9aa8a50c81
commit 1b21e69b40
3 changed files with 20 additions and 8 deletions

View File

@@ -59,7 +59,8 @@ export default {
};
},
meteor: {
notes(){
notes() {
// Get all the notes that aren't children of group folders or of other displayed notes
const folderIds = CreatureProperties.find({
'ancestors.id': this.creatureId,
type: 'folder',
@@ -68,8 +69,8 @@ export default {
removed: { $ne: true },
inactive: { $ne: true },
}, { fields: { _id: 1 } }).map(folder => folder._id);
return CreatureProperties.find({
const noteFilter = {
'ancestors.id': {
$eq: this.creatureId,
},
@@ -77,9 +78,20 @@ export default {
$nin: folderIds,
},
type: 'note',
removed: {$ne: true},
inactive: {$ne: true},
}, {
removed: { $ne: true },
inactive: { $ne: true },
};
const noteIds = CreatureProperties.find(noteFilter, {
sort: { order: 1 },
fields: {_id: 1},
}).map(note => note._id);
noteFilter['ancestors.id'] = {
$eq: this.creatureId,
$nin: noteIds,
}
return CreatureProperties.find(noteFilter, {
sort: {order: 1},
});
},

2
app/package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "dicecloud",
"version": "2.0.51",
"version": "2.0.57",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -125,4 +125,4 @@
]
}
}
}
}