From 821981e57918cc4585b788605a6efa13ab96538a Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 18 Oct 2022 12:30:38 +0200 Subject: [PATCH] :bug: Fix wrong email in the info message at change email --- CHANGES.md | 2 ++ .../src/app/main/ui/settings/change_email.cljs | 18 +++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 168bf5e1d..8f785fa6a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ - Fix wrong validation text after interaction with 2 and more files [Taiga #4276](https://tree.taiga.io/project/penpot/issue/4276) - Fix auto-width for texts can make text appear stretched [Github #2482](https://github.com/penpot/penpot/issues/2482) - Fix boards name do not disappear in focus mode [#4272](https://tree.taiga.io/project/penpot/issue/4272) +- Fix wrong email in the info message at change email [Taiga #4274](https://tree.taiga.io/project/penpot/issue/4274) + ## 1.16.0-beta ### :boom: Breaking changes & Deprecations diff --git a/frontend/src/app/main/ui/settings/change_email.cljs b/frontend/src/app/main/ui/settings/change_email.cljs index 14d69e1e5..468f18dde 100644 --- a/frontend/src/app/main/ui/settings/change_email.cljs +++ b/frontend/src/app/main/ui/settings/change_email.cljs @@ -52,20 +52,19 @@ (rx/throw error))) (defn- on-success - [form data] + [profile data] (if (:changed data) (st/emit! (du/fetch-profile) (modal/hide)) - (let [email (get-in @form [:clean-data :email-1]) - message (tr "notifications.validation-email-sent" email)] + (let [message (tr "notifications.validation-email-sent" (:email profile))] (st/emit! (dm/info message) (modal/hide))))) (defn- on-submit - [form _event] + [profile form _event] (let [params {:email (get-in @form [:clean-data :email-1])} mdata {:on-error (partial on-error form) - :on-success (partial on-success form)}] + :on-success (partial on-success profile)}] (st/emit! (du/request-email-change (with-meta params mdata))))) (mf/defc change-email-modal @@ -77,7 +76,12 @@ :validators [email-equality] :initial profile) on-close - (mf/use-callback #(st/emit! (modal/hide)))] + (mf/use-callback #(st/emit! (modal/hide))) + + on-submit + (mf/use-callback + (mf/deps profile) + (partial on-submit profile))] [:div.modal-overlay [:div.modal-container.change-email-modal.form-container @@ -86,7 +90,7 @@ [:div.modal-header [:div.modal-header-title - [:h2 {:data-test "change-email-title"} + [:h2 {:data-test "change-email-title"} (tr "modals.change-email.title")]] [:div.modal-close-button {:on-click on-close} i/close]]