From 4b8acd4e4e958b08f7d8608c7a4d33ab1d79dd30 Mon Sep 17 00:00:00 2001 From: Ejaaz Khan Date: Tue, 10 Mar 2026 12:40:53 +0530 Subject: [PATCH] fix(form): email trigger not working --- .../js/frappe/form/footer/form_timeline.js | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index e4019953f7..c979bb3270 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -12,13 +12,14 @@ class FormTimeline extends BaseTimeline { super.make(); this.setup_timeline_actions(); this.render_timeline_items(); + this.setup_activity_toggle(); } refresh() { super.refresh(); this.frm.trigger("timeline_refresh"); - this.setup_activity_toggle(); this.setup_document_email_link(); + this.toggle_show_all_activity(); } setup_timeline_actions() { @@ -48,11 +49,18 @@ class FormTimeline extends BaseTimeline { } } - setup_activity_toggle() { - const doc_info = this.doc_info || this.frm.get_docinfo(); - const has_communications = () => - doc_info.communications?.length || doc_info.comments?.length; + toggle_show_all_activity() { + this.timeline_wrapper + .find(".timeline-item .show-all-activity") + .toggle(this.has_communications()); + } + has_communications() { + const doc_info = this.doc_info || this.frm.get_docinfo(); + return doc_info.communications?.length || doc_info.comments?.length; + } + + setup_activity_toggle() { this.timeline_wrapper.remove(this.timeline_actions_wrapper); this.timeline_wrapper.find(".timeline-item.activity-title").remove(); this.timeline_wrapper.prepend(` @@ -62,28 +70,26 @@ class FormTimeline extends BaseTimeline { `); const me = this; - if (has_communications()) { - this.timeline_wrapper - .find(".timeline-item.activity-title") - .append( - ` -
- ${__("Show all activity")} - -
+ this.timeline_wrapper + .find(".timeline-item.activity-title") + .append( ` - ) - .find("input[type=checkbox]") - .prop("checked", !me.only_communication) - .on("click", function (e) { - me.only_communication = !this.checked; - me.render_timeline_items(); - $(this).tab("show"); - }); - } +
+ ${__("Show all activity")} + +
+ ` + ) + .find("input[type=checkbox]") + .prop("checked", !me.only_communication) + .on("click", function (e) { + me.only_communication = !this.checked; + me.render_timeline_items(); + $(this).tab("show"); + }); this.timeline_wrapper .find(".timeline-item.activity-title") .append(this.timeline_actions_wrapper);