diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py index 7dec249be1..00f29b6ffe 100644 --- a/frappe/desk/form/load.py +++ b/frappe/desk/form/load.py @@ -165,7 +165,7 @@ def get_communication_data(doctype, name, start=0, limit=20, after=None, fields= '''Returns list of communications for a given document''' if not fields: fields = '''`name`, `communication_type`,`communication_medium`, `comment_type`, - `communication_date`, `content`, `sender`, `sender_full_name`, + `communication_date`, `content`, `sender`, `sender_full_name`, `cc`, `bcc`, `creation`, `subject`, `delivery_status`, `_liked_by`, `timeline_doctype`, `timeline_name`, `reference_doctype`, `reference_name`, `link_doctype`, `link_name`, `read_by_recipient`, `rating`, 'Communication' AS `doctype`''' diff --git a/frappe/public/js/frappe/form/footer/timeline.js b/frappe/public/js/frappe/form/footer/timeline.js index 4d8585b045..70ac4e4241 100644 --- a/frappe/public/js/frappe/form/footer/timeline.js +++ b/frappe/public/js/frappe/form/footer/timeline.js @@ -289,28 +289,38 @@ frappe.ui.form.Timeline = class Timeline { } add_reply_btn_event($timeline_item, c) { - var me = this; - $timeline_item.find(".reply-link").on("click", function() { - var name = $(this).attr("data-name"); + $timeline_item.on('click', '.reply-link, .reply-link-all', (e) => { var last_email = null; - // find the email tor reply to - me.get_communications().forEach(function(c) { - if(c.name==name) { + const $target = $(e.currentTarget); + const name = $target.data().name; + + // find the email to reply to + this.get_communications().forEach(function(c) { + if(c.name == name) { last_email = c; return false; } }); - // make the composer - new frappe.views.CommunicationComposer({ - doc: me.frm.doc, + const opts = { + doc: this.frm.doc, txt: "", title: __('Reply'), - frm: me.frm, - last_email: last_email, + frm: this.frm, + last_email, is_a_reply: true - }); + }; + + if ($target.is('.reply-link-all')) { + if (last_email) { + opts.cc = last_email.cc; + opts.bcc = last_email.bcc; + } + } + + // make the composer + new frappe.views.CommunicationComposer(opts); }); } @@ -834,4 +844,4 @@ $.extend(frappe.timeline, { return index; } -}) \ No newline at end of file +}); diff --git a/frappe/public/js/frappe/form/footer/timeline_item.html b/frappe/public/js/frappe/form/footer/timeline_item.html index c2965dd98c..d5f717f977 100755 --- a/frappe/public/js/frappe/form/footer/timeline_item.html +++ b/frappe/public/js/frappe/form/footer/timeline_item.html @@ -95,6 +95,8 @@ && data.sender !== frappe.session.user_email) { %} {%= __("Reply") %} + {%= __("Reply All") %} {% } %} {% } %}