From 3896a0b03df9954188a35f17bef760ddce7419be Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 24 Mar 2022 14:54:36 -0600 Subject: [PATCH] IO-1799 Change from address for emails. --- bodyshop_translations.babel | 42 +++++++++++++++++++ .../email-overlay/email-overlay.component.jsx | 35 +++++++++++++++- .../email-overlay/email-overlay.container.jsx | 12 +++--- .../shop-info/shop-info.general.component.jsx | 13 ++++++ client/src/graphql/bodyshop.queries.js | 2 + client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + hasura/metadata/tables.yaml | 2 + .../down.sql | 4 ++ .../up.sql | 2 + 11 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 hasura/migrations/1648154167416_alter_table_public_bodyshops_add_column_md_from_emails/down.sql create mode 100644 hasura/migrations/1648154167416_alter_table_public_bodyshops_add_column_md_from_emails/up.sql diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 28764f991..fe1e7a2a0 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -4598,6 +4598,27 @@ + + md_from_emails + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + md_hour_split @@ -13231,6 +13252,27 @@ + + from + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + subject false diff --git a/client/src/components/email-overlay/email-overlay.component.jsx b/client/src/components/email-overlay/email-overlay.component.jsx index 6826eba76..baf52d376 100644 --- a/client/src/components/email-overlay/email-overlay.component.jsx +++ b/client/src/components/email-overlay/email-overlay.component.jsx @@ -16,9 +16,14 @@ import EmailDocumentsComponent from "../email-documents/email-documents.componen import _ from "lodash"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop } from "../../redux/user/user.selectors"; +import { + selectBodyshop, + selectCurrentUser, +} from "../../redux/user/user.selectors"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, + currentUser: selectCurrentUser, }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) @@ -28,7 +33,12 @@ export default connect( mapDispatchToProps )(EmailOverlayComponent); -export function EmailOverlayComponent({ form, selectedMediaState, bodyshop }) { +export function EmailOverlayComponent({ + form, + selectedMediaState, + bodyshop, + currentUser, +}) { const { t } = useTranslation(); const handleClick = ({ item, key, keyPath }) => { const email = item.props.value; @@ -51,6 +61,27 @@ export function EmailOverlayComponent({ form, selectedMediaState, bodyshop }) { return (
+ + + diff --git a/client/src/components/email-overlay/email-overlay.container.jsx b/client/src/components/email-overlay/email-overlay.container.jsx index c2dc7d261..9276f35ee 100644 --- a/client/src/components/email-overlay/email-overlay.container.jsx +++ b/client/src/components/email-overlay/email-overlay.container.jsx @@ -56,13 +56,9 @@ export function EmailOverlayContainer({ : bodyshop.shopname, address: EmailSettings.fromAddress, }, - ReplyTo: { - Email: currentUser.validemail ? currentUser.email : bodyshop.email, - Name: currentUser.displayName, - }, }; - const handleFinish = async (values) => { + const handleFinish = async (allValues) => { logImEXEvent("email_send_from_modal"); //const attachments = []; @@ -77,10 +73,15 @@ export function EmailOverlayContainer({ // attachments.push(t); // }); + const { from, ...values } = allValues; setSending(true); try { await axios.post("/sendemail", { ...defaultEmailFrom, + ReplyTo: { + Email: from, + Name: currentUser.displayName, + }, ...values, html: rawHtml, attachments: [ @@ -138,6 +139,7 @@ export function EmailOverlayContainer({ } form.setFieldsValue({ + from: currentUser.validemail ? currentUser.email : bodyshop.email, ...emailConfig.messageOptions, cc: emailConfig.messageOptions.cc && diff --git a/client/src/components/shop-info/shop-info.general.component.jsx b/client/src/components/shop-info/shop-info.general.component.jsx index 29288b9ee..186234adf 100644 --- a/client/src/components/shop-info/shop-info.general.component.jsx +++ b/client/src/components/shop-info/shop-info.general.component.jsx @@ -507,6 +507,19 @@ export default function ShopInfoGeneral({ form }) { > + +