Skip to content

Commit c3418cd

Browse files
authored
fix: add null checks for frm.timeline in activity.js
1 parent 9c3b04a commit c3418cd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

frappe_gmail_thread/public/js/activity.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function page_changed(event) {
88
if (route[0] == "Form") {
99
frappe.ui.form.on(route[1], {
1010
refresh: function (frm) {
11-
if (frm.timeline.doc_info.additional_timeline_content) {
11+
if (frm.timeline && frm.timeline.doc_info && frm.timeline.doc_info.additional_timeline_content) {
1212
let gthread_users = new Set();
1313
for (let activity of frm.timeline.doc_info.additional_timeline_content) {
1414
if (activity.doctype === "Gmail Thread") {
@@ -27,12 +27,15 @@ function page_changed(event) {
2727
const user_info = r.message;
2828
if ($.isEmptyObject(user_info)) return;
2929
frappe.update_user_info(user_info);
30-
frm.timeline.refresh();
30+
if (frm.timeline) {
31+
frm.timeline.refresh();
32+
}
3133
});
3234
}
3335
frappe.realtime.on("gthread_new_email", function (data) {
34-
console.log("Received new email");
35-
frm.timeline.refresh();
36+
if (frm.timeline) {
37+
frm.timeline.refresh();
38+
}
3639
});
3740
},
3841
});

0 commit comments

Comments
 (0)