From 2299945d0359563c555e248e185420da0c9d712f Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Mon, 5 May 2025 17:09:27 +0530 Subject: [PATCH] fix(email_account): don't show gmail help text after selecting another provider Signed-off-by: Akhil Narang --- .../doctype/email_account/email_account.js | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.js b/frappe/email/doctype/email_account/email_account.js index a36976d3a8..a12fa3b295 100644 --- a/frappe/email/doctype/email_account/email_account.js +++ b/frappe/email/doctype/email_account/email_account.js @@ -117,23 +117,33 @@ function set_default_max_attachment_size(frm) { } function add_helpful_links(frm) { // For better UX - switch (frm.doc.service) { - case "GMail": - frm.set_df_property( - "password", - "description", - 'To generate password visit here' - ); - break; - case "Frappe Mail": - frm.set_df_property( - "api_secret", - "description", - 'To know more visit here' - ); - break; + if (frm.doc.service === "GMail") { + frm.set_df_property( + "password", + "description", + __("To generate password click {0}", [ + "" + + __("here") + + "", + ]) + ); + } else { + frm.set_df_property("password", "description", ""); + } + + if (frm.doc.service === "Frappe Mail") { + frm.set_df_property( + "api_secret", + "description", + __("To know more click {0}", [ + "" + __("here") + "", + ]) + ); + } else { + frm.set_df_property("api_secret", "description", ""); } } + frappe.ui.form.on("Email Account", { service: function (frm) { $.each(frappe.email_defaults[frm.doc.service], function (key, value) {