Skip to content

Commit

Permalink
feat: 3570 - Grant Activity digest notification preference (#3582)
Browse files Browse the repository at this point in the history
  • Loading branch information
phm200 authored Oct 8, 2024
1 parent b7aa607 commit 4a4cdf1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/client/src/views/MyProfileView.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('MyProfileView.vue', () => {
GRANT_INTEREST: 'SUBSCRIBED',
GRANT_DIGEST: 'SUBSCRIBED',
GRANT_FINDER_UPDATES: 'SUBSCRIBED',
GRANT_ACTIVITY: 'SUBSCRIBED',
},
}),
},
Expand Down Expand Up @@ -62,4 +63,19 @@ describe('MyProfileView.vue', () => {
);
});
});

describe('grant activity preference', () => {
it('should show grant activity terminology', () => {
const wrapper = shallowMount(MyProfileView, {
global: {
plugins: [store],
},
});
const text = wrapper.text();
expect(text).toContain('Grant Activity');
expect(text).toContain(
'Send me a daily summary of new activity for grants that I follow.',
);
});
});
});
5 changes: 5 additions & 0 deletions packages/client/src/views/MyProfileView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export default {
key: 'GRANT_ASSIGNMENT',
description: shareTerminologyEnabledFlag ? grantShareDescription : grantAssignmentDescription,
},
{
name: 'Grant Activity',
key: 'GRANT_ACTIVITY',
description: 'Send me a daily summary of new activity for grants that I follow.',
},
],
breadcrumb_items: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function (knex) {
return knex.schema.raw(
`
-- Drop the existing stale constraint
ALTER TABLE email_subscriptions DROP CONSTRAINT email_subscriptions_notification_type_check;
-- Add new updated constraint
ALTER TABLE email_subscriptions ADD CONSTRAINT email_subscriptions_notification_type_check CHECK (notification_type IN ('GRANT_ASSIGNMENT', 'GRANT_INTEREST', 'GRANT_DIGEST', 'GRANT_FINDER_UPDATES', 'GRANT_ACTIVITY'));
`,
);
};

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function (knex) {
return knex.schema.raw(
`
-- Drop the existing stale constraint
ALTER TABLE email_subscriptions DROP CONSTRAINT email_subscriptions_notification_type_check;
-- Add new updated constraint
ALTER TABLE email_subscriptions ADD CONSTRAINT email_subscriptions_notification_type_check CHECK (notification_type IN ('GRANT_ASSIGNMENT', 'GRANT_INTEREST', 'GRANT_DIGEST', 'GRANT_FINDER_UPDATES'));
`,
);
};
1 change: 1 addition & 0 deletions packages/server/src/lib/email/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const notificationType = Object.freeze({
grantInterest: 'GRANT_INTEREST',
grantDigest: 'GRANT_DIGEST',
grantFinderUpdates: 'GRANT_FINDER_UPDATES',
grantActivity: 'GRANT_ACTIVITY',
});

const emailSubscriptionStatus = Object.freeze({
Expand Down

0 comments on commit 4a4cdf1

Please sign in to comment.