diff --git a/__tests__/alerts.ts b/__tests__/alerts.ts index 4f6870b613..e40726d105 100644 --- a/__tests__/alerts.ts +++ b/__tests__/alerts.ts @@ -101,12 +101,12 @@ describe('query userAlerts', () => { const res = await client.query(QUERY); delete expected.userId; + delete expected.flags; expect(res.data.userAlerts).toEqual({ ...expected, lastBanner: expected.lastBanner.toISOString(), lastChangelog: expected.lastChangelog.toISOString(), - lastFeedSettingsFeedback: expected.lastFeedSettingsFeedback.toISOString(), }); }); @@ -275,6 +275,7 @@ describe('dedicated api routes', () => { await repo.findOneByOrFail({ userId: '1' })!, ); delete expected['userId']; + delete expected['flags']; loggedUser = '1'; const res = await authorizeRequest( diff --git a/__tests__/boot.ts b/__tests__/boot.ts index ea95db1a1f..991760a017 100644 --- a/__tests__/boot.ts +++ b/__tests__/boot.ts @@ -114,6 +114,7 @@ const LOGGED_IN_BODY = { alerts: { ...BASE_BODY.alerts, bootPopup: true, + flags: {}, }, accessToken: { expiresIn: expect.any(String), diff --git a/src/schema/alerts.ts b/src/schema/alerts.ts index 429834fbe7..f1c8f8d2d3 100644 --- a/src/schema/alerts.ts +++ b/src/schema/alerts.ts @@ -208,13 +208,17 @@ export const typeDefs = /* GraphQL */ ` `; /** - * Remove the flags from the alerts object + * Remove the non public flags from the alerts object * @param alerts */ export const saveReturnAlerts = (alerts: Alerts) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { flags, ...data } = alerts; - return data; + return { + ...data, + flags: { + hasSeenOpportunity: flags?.hasSeenOpportunity, + }, + }; }; interface GQLAlertInputInternalInput {