Skip to content

Commit d6af842

Browse files
authored
Fix requestingUser not being forward to project filters (#3259)
1 parent 9990714 commit d6af842

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/components/engagement/engagement.repository.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,12 @@ export const engagementFilters = filter.define(() => EngagementFilters, {
571571
relation('out', '', 'language'),
572572
node('', 'Language', { id }),
573573
]),
574-
project: filter.sub(() => projectFilters)((sub) =>
574+
project: filter.sub(
575+
() => projectFilters,
576+
'requestingUser',
577+
)((sub) =>
575578
sub
576-
.with('node as eng')
579+
.with('node as eng, requestingUser')
577580
.match([
578581
node('eng'),
579582
relation('in', '', 'engagement'),

src/core/database/query/filters.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cleanSplit, entries, Nil } from '@seedcompany/common';
1+
import { cleanSplit, entries, many, Many, Nil } from '@seedcompany/common';
22
import {
33
comparisions,
44
greaterThan,
@@ -219,6 +219,7 @@ export const comparisonOfDateTimeFilter = (
219219
export const sub =
220220
<Input extends Record<string, any>>(
221221
subBuilder: () => (input: Partial<Input>) => (q: Query) => void,
222+
extraInput?: Many<string>,
222223
) =>
223224
<
224225
// TODO this doesn't enforce Input type on Outer property
@@ -229,7 +230,7 @@ export const sub =
229230
): Builder<Outer, K> =>
230231
({ key, value, query }) =>
231232
query
232-
.subQuery('node', (sub) =>
233+
.subQuery(['node', ...many(extraInput ?? [])], (sub) =>
233234
sub
234235
.apply(matchSubNode)
235236
.apply(subBuilder()(value))

0 commit comments

Comments
 (0)