Skip to content

Commit 63b8ae9

Browse files
authored
fix: alert boot public flags (#3283)
1 parent 2386c5a commit 63b8ae9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

__tests__/alerts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ describe('query userAlerts', () => {
101101
const res = await client.query(QUERY);
102102

103103
delete expected.userId;
104+
delete expected.flags;
104105

105106
expect(res.data.userAlerts).toEqual({
106107
...expected,
107108
lastBanner: expected.lastBanner.toISOString(),
108109
lastChangelog: expected.lastChangelog.toISOString(),
109-
lastFeedSettingsFeedback: expected.lastFeedSettingsFeedback.toISOString(),
110110
});
111111
});
112112

@@ -275,6 +275,7 @@ describe('dedicated api routes', () => {
275275
await repo.findOneByOrFail({ userId: '1' })!,
276276
);
277277
delete expected['userId'];
278+
delete expected['flags'];
278279

279280
loggedUser = '1';
280281
const res = await authorizeRequest(

__tests__/boot.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const LOGGED_IN_BODY = {
114114
alerts: {
115115
...BASE_BODY.alerts,
116116
bootPopup: true,
117+
flags: {},
117118
},
118119
accessToken: {
119120
expiresIn: expect.any(String),

src/schema/alerts.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,17 @@ export const typeDefs = /* GraphQL */ `
208208
`;
209209

210210
/**
211-
* Remove the flags from the alerts object
211+
* Remove the non public flags from the alerts object
212212
* @param alerts
213213
*/
214214
export const saveReturnAlerts = (alerts: Alerts) => {
215-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
216215
const { flags, ...data } = alerts;
217-
return data;
216+
return {
217+
...data,
218+
flags: {
219+
hasSeenOpportunity: flags?.hasSeenOpportunity,
220+
},
221+
};
218222
};
219223

220224
interface GQLAlertInputInternalInput {

0 commit comments

Comments
 (0)