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

2
app/package-lock.json generated
View File

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

View File

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