From e485b6a14254ecf14248efaba033008ce670e6b3 Mon Sep 17 00:00:00 2001 From: Shelley Nason Date: Tue, 19 Dec 2023 17:07:00 -0600 Subject: [PATCH] fix: remove "Occasional Updates" toggle from profile page --- .../src/components/EmailSettingsBanner.vue | 75 ------------------- .../src/components/Modals/ProfileSettings.vue | 3 +- packages/client/src/store/modules/users.js | 5 +- packages/client/src/views/MyProfile.vue | 8 +- 4 files changed, 4 insertions(+), 87 deletions(-) delete mode 100644 packages/client/src/components/EmailSettingsBanner.vue diff --git a/packages/client/src/components/EmailSettingsBanner.vue b/packages/client/src/components/EmailSettingsBanner.vue deleted file mode 100644 index eb4867e9f..000000000 --- a/packages/client/src/components/EmailSettingsBanner.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - diff --git a/packages/client/src/components/Modals/ProfileSettings.vue b/packages/client/src/components/Modals/ProfileSettings.vue index 1de0a98fd..ec6c92055 100644 --- a/packages/client/src/components/Modals/ProfileSettings.vue +++ b/packages/client/src/components/Modals/ProfileSettings.vue @@ -91,7 +91,7 @@ export default { methods: { ...mapActions({ changeSelectedAgency: 'users/changeSelectedAgency', - updateEmailSubscriptionPreferences: 'users/updateEmailSubscriptionPreferences', + updateEmailSubscriptionPreferences: 'users/updateEmailSubscriptionPreferencesForLoggedInUser', }), resetModal() { this.$emit('update:showModal', false); @@ -103,7 +103,6 @@ export default { }; data.forEach((notificationType) => { updatedPreferences[notificationType] = 'SUBSCRIBED'; }); this.updateEmailSubscriptionPreferences({ - userId: this.loggedInUser.id, preferences: updatedPreferences, }); }, diff --git a/packages/client/src/store/modules/users.js b/packages/client/src/store/modules/users.js index 4fd5d0bb2..d26efb77e 100644 --- a/packages/client/src/store/modules/users.js +++ b/packages/client/src/store/modules/users.js @@ -79,15 +79,14 @@ export default { } await dispatch('fetchUsers'); }, - async updateEmailSubscriptionPreferences({ dispatch, commit }, { userId, preferences }) { + async updateEmailSubscriptionPreferencesForLoggedInUser({ commit, getters }, { preferences }) { const data = await fetchApi.put( - `/api/organizations/:organizationId/users/${userId}/email_subscription`, + `/api/organizations/:organizationId/users/${getters.loggedInUser.id}/email_subscription`, { preferences, }, ); commit('SET_LOGGED_IN_USER', data.user); - dispatch('fetchUsers'); }, }, mutations: { diff --git a/packages/client/src/views/MyProfile.vue b/packages/client/src/views/MyProfile.vue index c3082d156..b5f5eab10 100644 --- a/packages/client/src/views/MyProfile.vue +++ b/packages/client/src/views/MyProfile.vue @@ -61,11 +61,6 @@ export default { 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.', - }, ], breadcrumb_items: [ { @@ -98,7 +93,7 @@ export default { }, methods: { ...mapActions({ - updateEmailSubscriptionPreferences: 'users/updateEmailSubscriptionPreferences', + updateEmailSubscriptionPreferences: 'users/updateEmailSubscriptionPreferencesForLoggedInUser', }), onUpdateEmailPreference(pref) { const updatedPreferences = { @@ -106,7 +101,6 @@ export default { [pref.key]: pref.checked ? 'SUBSCRIBED' : 'UNSUBSCRIBED', }; this.updateEmailSubscriptionPreferences({ - userId: this.loggedInUser.id, preferences: updatedPreferences, }); },