feat(email): Add reply all option in timeline (#6733)

This commit is contained in:
Chinmay Pai 2019-04-29 17:43:52 +05:30 committed by Faris Ansari
parent 901a9b9a1c
commit 81ee1870e0
5 changed files with 34 additions and 20 deletions

View file

@ -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`'''

View file

@ -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;
}
})
});

View file

@ -95,6 +95,8 @@
&& data.sender !== frappe.session.user_email) { %}
<a class="text-muted reply-link pull-right timeline-content-show"
data-name="{%= data.name %}" title="{%= __("Reply") %}">{%= __("Reply") %}</a>
<a class="text-muted reply-link-all pull-right timeline-content-show"
data-name="{%= data.name %}" title="{%= __("Reply All") %}">{%= __("Reply All") %}</a>
{% } %}
{% } %}
<span class="text-muted commented-on hidden-xs {% if (data.futur_date) { %}timeline-futur{% } %}">

View file

@ -579,13 +579,15 @@ h6.uppercase, .h6.uppercase {
.timeline-indicator();
}
.timeline-item.notification-content.dark::before {
background-color: @text-color;
.timeline-item {
.reply-link, .reply-link-all {
margin-left: 15px;
font-size: 12px;
}
}
.timeline-item .reply-link {
margin-left: 15px;
font-size: 12px;
.timeline-item.notification-content.dark::before {
background-color: @text-color;
}
.timeline-head {

View file

@ -444,7 +444,7 @@ body {
.links-active {
padding-right: 10px;
}
.reply-link {
.reply-link, .reply-link-all {
margin-left: 0;
}
.asset-details {