Skip to content

Commit

Permalink
fix: search events by user ID, not by user name (#7846)
Browse files Browse the repository at this point in the history
Changes the event search handling, so that searching by user uses the
user's ID, not the "createdBy" name in the event. This aligns better
with what the OpenAPI schema describes it.
  • Loading branch information
thomasheartman authored Aug 13, 2024
1 parent 507219e commit 0934c6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/features/events/event-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class EventService {

if (params.createdBy) {
const parsed = parseSearchOperatorValue(
'created_by',
'created_by_user_id',
params.createdBy,
);
if (parsed) queryParams.push(parsed);
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/api/admin/event-search.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ test('should filter events by created by', async () => {
await eventService.storeEvent({
type: FEATURE_CREATED,
createdBy: '[email protected]',
createdByUserId: TEST_USER_ID,
createdByUserId: TEST_USER_ID + 1,
ip: '127.0.0.1',
});

Expand All @@ -194,7 +194,7 @@ test('should filter events by created by', async () => {
ip: '127.0.0.1',
});

const { body } = await searchEvents({ createdBy: 'IS:[email protected]' });
const { body } = await searchEvents({ createdBy: `IS:${TEST_USER_ID}` });

expect(body).toMatchObject({
events: [
Expand Down

0 comments on commit 0934c6c

Please sign in to comment.