From cba1c77d97c61716397c368bbd42b4a37f9b00c6 Mon Sep 17 00:00:00 2001 From: aditya Date: Wed, 22 Nov 2023 15:23:38 -0500 Subject: [PATCH] Prod Release 2023-11-21 - Take 1 (#2143) --- packages/client/src/components/Layout.vue | 3 +- packages/client/src/views/MyProfile.vue | 45 +++++++++++++++++++++++ packages/server/src/routes/users.js | 2 +- terraform/modules/gost_website/waf.tf | 2 +- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/packages/client/src/components/Layout.vue b/packages/client/src/components/Layout.vue index f0ebbed24a..57d5a131aa 100755 --- a/packages/client/src/components/Layout.vue +++ b/packages/client/src/components/Layout.vue @@ -30,8 +30,7 @@ Training Guide Sign Out - - + {{selectedTeam ? selectedTeam.name : ''}} diff --git a/packages/client/src/views/MyProfile.vue b/packages/client/src/views/MyProfile.vue index 605ea64dcb..10e3a27dfd 100644 --- a/packages/client/src/views/MyProfile.vue +++ b/packages/client/src/views/MyProfile.vue @@ -66,6 +66,27 @@ export default { ], }; }, + data() { + return { + prefs: [ + { + name: 'New Grant Digest', + key: 'GRANT_DIGEST', + description: 'Send me a daily email if new grants match my saved search(es).', + }, + { + name: 'Grants Assignment', + key: 'GRANT_ASSIGNMENT', + description: 'Send me notifications if a grant has been assigned to my USDR Grants team.', + }, + { + name: 'Occasional Updates', + key: 'GRANT_FINDER_UPDATES', + description: 'Send me occasional emails about feature releases, surveys, and other updates.', + }, + ], + }; + }, computed: { ...mapGetters({ loggedInUser: 'users/loggedInUser', @@ -82,6 +103,30 @@ export default { emailPreferences() { return this.loggedInUser.emailPreferences; }, + emailPreferences() { + return this.loggedInUser.emailPreferences; + }, + }, + methods: { + ...mapActions({ + updateEmailSubscriptionPreferences: 'users/updateEmailSubscriptionPreferences', + }), + onUpdateEmailPreference(pref) { + const updatedPreferences = { + ...this.emailPreferences, + [pref.key]: pref.checked ? 'SUBSCRIBED' : 'UNSUBSCRIBED', + }; + this.updateEmailSubscriptionPreferences({ + userId: this.loggedInUser.id, + preferences: updatedPreferences, + }); + }, + }, + beforeMount() { + this.prefs.forEach((pref) => { + // eslint-disable-next-line no-param-reassign + pref.checked = this.emailPreferences[pref.key] === 'SUBSCRIBED'; + }); }, methods: { ...mapActions({ diff --git a/packages/server/src/routes/users.js b/packages/server/src/routes/users.js index f483144a7f..fb4a779f89 100755 --- a/packages/server/src/routes/users.js +++ b/packages/server/src/routes/users.js @@ -70,7 +70,7 @@ router.patch('/:userId', requireUser, async (req, res) => { return; } - const allowedFields = new Set(['name', 'avatar_color']); + const allowedFields = new Set(['name']); for (const key of Object.keys(req.body)) { if (!allowedFields.has(key)) { res.status(400).json({ message: `Request body contains unsupported field: ${key}` }); diff --git a/terraform/modules/gost_website/waf.tf b/terraform/modules/gost_website/waf.tf index 41e400a851..c08a0958f9 100644 --- a/terraform/modules/gost_website/waf.tf +++ b/terraform/modules/gost_website/waf.tf @@ -18,7 +18,7 @@ locals { module "waf" { source = "cloudposse/waf/aws" - version = "0.3.0" + version = "0.4.0" scope = "CLOUDFRONT" default_action = "allow"