Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion __tests__/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
});

Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions __tests__/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const LOGGED_IN_BODY = {
alerts: {
...BASE_BODY.alerts,
bootPopup: true,
flags: {},
},
accessToken: {
expiresIn: expect.any(String),
Expand Down
10 changes: 7 additions & 3 deletions src/schema/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading