diff --git a/src/services/entry/actions/get-related-entries.ts b/src/services/entry/actions/get-related-entries.ts index 1e421c1c..e7225b48 100644 --- a/src/services/entry/actions/get-related-entries.ts +++ b/src/services/entry/actions/get-related-entries.ts @@ -68,8 +68,15 @@ export async function getRelatedEntries( endToStart ? 'l.fromId' : 'l.toId', ) .join('entries', 'entries.entryId', endToStart ? 'l.toId' : 'l.fromId') - .where('isDeleted', false) - .where('depth', '<', 5); + .where((builder) => { + builder.where({isDeleted: false}); + + builder.andWhere('depth', '<', 5); + + if (scope) { + builder.andWhere('entries.scope', scope); + } + }); }); }) .select()