From 8c29b0f1d44326ecbb13a735607f0d3197a881b9 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 8 May 2018 15:20:56 -0600 Subject: [PATCH 1/2] fix for delete --- graph/mutators/user.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/graph/mutators/user.js b/graph/mutators/user.js index 8b9afc206..7422f2290 100644 --- a/graph/mutators/user.js +++ b/graph/mutators/user.js @@ -70,15 +70,25 @@ const setRole = (ctx, id, role) => { /** * transforms a specific action to a removal action on the target model. */ -const actionDecrTransformer = ({ item_id, action_type, group_id }) => ({ - query: { id: item_id }, - update: { +const actionDecrTransformer = ({ item_id, action_type, group_id }) => { + const update = { $inc: { [`action_counts.${action_type.toLowerCase()}`]: -1, - [`action_counts.${action_type.toLowerCase()}_${group_id.toLowerCase()}`]: -1, }, - }, -}); + }; + + if (group_id) { + // If the action had a groupID, also decrement that key. + update.$inc[ + `action_counts.${action_type.toLowerCase()}_${group_id.toLowerCase()}` + ] = -1; + } + + return { + query: { id: item_id }, + update, + }; +}; // delUser will delete a given user with the specified id. const delUser = async (ctx, id) => { From 1815bd4d75275e8008ecb90f58f51820f463692b Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 8 May 2018 15:30:12 -0600 Subject: [PATCH 2/2] fix translation copy --- .../client/components/DeleteMyAccount.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/talk-plugin-profile-data/client/components/DeleteMyAccount.js b/plugins/talk-plugin-profile-data/client/components/DeleteMyAccount.js index bbada134f..179fa0193 100644 --- a/plugins/talk-plugin-profile-data/client/components/DeleteMyAccount.js +++ b/plugins/talk-plugin-profile-data/client/components/DeleteMyAccount.js @@ -27,7 +27,7 @@ class DeleteMyAccount extends React.Component { const { cancelAccountDeletion, notify } = this.props; try { await cancelAccountDeletion(); - notify('success', t('delete_request.account_deletion_requested')); + notify('success', t('delete_request.account_deletion_cancelled')); } catch (err) { notify('error', getErrorMessages(err)); }