diff --git a/frappe/public/js/frappe/form/footer/base_timeline.js b/frappe/public/js/frappe/form/footer/base_timeline.js
index d7ae78d748..e78c288159 100644
--- a/frappe/public/js/frappe/form/footer/base_timeline.js
+++ b/frappe/public/js/frappe/form/footer/base_timeline.js
@@ -99,6 +99,23 @@ class BaseTimeline {
// timeline_badge, icon, icon_size,
// hide_timestamp, is_card
const timeline_item = $(`
`);
+
+ if (item.name == "load-more") {
+ timeline_item.append(
+ `
+
+
`
+ );
+ timeline_item.find(".btn-load-more").on("click", async () => {
+ let more_items = await this.get_more_communication_timeline_contents();
+ timeline_item.remove();
+ this.add_timeline_items_based_on_creation(more_items);
+ });
+ return timeline_item;
+ }
+
timeline_item.attr({
"data-doctype": item.doctype,
"data-name": item.name,
@@ -128,22 +145,6 @@ class BaseTimeline {
timeline_content.attr("id", item.id);
}
- if (item.append_load_more) {
- timeline_item.append(
- `
-
-
`
- );
- }
-
- timeline_item.find(".btn-load-more").on("click", async () => {
- let more_items = await this.get_more_communication_timeline_contents();
- timeline_item.find(".timeline-load-more").remove();
- this.add_timeline_items_based_on_creation(more_items);
- });
-
return timeline_item;
}
}