From e88d484214dae45275eb5694ef290fafe589af96 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 23 Feb 2021 14:00:44 +0530 Subject: [PATCH 1/5] fix: recipient based on communication --- frappe/public/js/frappe/form/footer/form_timeline.js | 4 ++-- frappe/public/js/frappe/views/communication.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 2559d8c01b..8e61548d33 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -358,7 +358,7 @@ class FormTimeline extends BaseTimeline { const args = { doc: this.frm.doc, frm: this.frm, - recipients: communication_doc ? communication_doc.sender : this.get_recipient(), + recipients: communication_doc && communication_doc.sender != frappe.session.user_email? communication_doc.sender : this.get_recipient(), is_a_reply: Boolean(communication_doc), title: communication_doc ? __('Reply') : null, last_email: communication_doc @@ -378,7 +378,7 @@ class FormTimeline extends BaseTimeline { const comment_value = frappe.markdown(this.frm.comment_box.get_value()); args.txt = strip_html(comment_value) ? comment_value : ''; } - + console.log(args) new frappe.views.CommunicationComposer(args); } diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index 260a7d995f..fb469d197d 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -721,7 +721,7 @@ frappe.views.CommunicationComposer = Class.extend({ signature = res.message.signature; } - if(!frappe.utils.is_html(signature)) { + if(signature && !frappe.utils.is_html(signature)) { signature = signature.replace(/\n/g, "
"); } From 9e3e77944258431421a05a2f370ba1c8f4790541 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 23 Feb 2021 19:44:17 +0530 Subject: [PATCH 2/5] fix: communication subject --- frappe/public/js/frappe/form/footer/form_timeline.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 8e61548d33..012a0f8e24 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -361,7 +361,8 @@ class FormTimeline extends BaseTimeline { recipients: communication_doc && communication_doc.sender != frappe.session.user_email? communication_doc.sender : this.get_recipient(), is_a_reply: Boolean(communication_doc), title: communication_doc ? __('Reply') : null, - last_email: communication_doc + last_email: communication_doc, + subject: communication_doc ? __("Re: {0}", [communication_doc.subject]) : __("Re: {0}", [this.frm.doc.subject]) }; if (communication_doc && reply_all) { @@ -378,7 +379,7 @@ class FormTimeline extends BaseTimeline { const comment_value = frappe.markdown(this.frm.comment_box.get_value()); args.txt = strip_html(comment_value) ? comment_value : ''; } - console.log(args) + new frappe.views.CommunicationComposer(args); } From 1524663c6f0462f9929f42c1a89e797738b174af Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 23 Feb 2021 20:06:59 +0530 Subject: [PATCH 3/5] fix: unnecesary condition removed --- frappe/public/js/frappe/views/communication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index fb469d197d..260a7d995f 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -721,7 +721,7 @@ frappe.views.CommunicationComposer = Class.extend({ signature = res.message.signature; } - if(signature && !frappe.utils.is_html(signature)) { + if(!frappe.utils.is_html(signature)) { signature = signature.replace(/\n/g, "
"); } From 3a713a015f173d6886f55e819afce0fb9c817d11 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 23 Feb 2021 21:06:17 +0530 Subject: [PATCH 4/5] fix: corrections to subject --- frappe/public/js/frappe/form/footer/form_timeline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 012a0f8e24..3c2f4dd762 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -362,7 +362,7 @@ class FormTimeline extends BaseTimeline { is_a_reply: Boolean(communication_doc), title: communication_doc ? __('Reply') : null, last_email: communication_doc, - subject: communication_doc ? __("Re: {0}", [communication_doc.subject]) : __("Re: {0}", [this.frm.doc.subject]) + subject: communication_doc && communication_doc.subject }; if (communication_doc && reply_all) { From e906479c0fe3ce87dc1489f82588399880fc45d9 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:38:17 +0530 Subject: [PATCH 5/5] style: Fix formatting --- frappe/public/js/frappe/form/footer/form_timeline.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 3c2f4dd762..7b8d36d90b 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -358,11 +358,11 @@ class FormTimeline extends BaseTimeline { const args = { doc: this.frm.doc, frm: this.frm, - recipients: communication_doc && communication_doc.sender != frappe.session.user_email? communication_doc.sender : this.get_recipient(), + recipients: communication_doc && communication_doc.sender != frappe.session.user_email ? communication_doc.sender : this.get_recipient(), is_a_reply: Boolean(communication_doc), title: communication_doc ? __('Reply') : null, last_email: communication_doc, - subject: communication_doc && communication_doc.subject + subject: communication_doc && communication_doc.subject }; if (communication_doc && reply_all) {