Merge branch 'staging' into develop

This commit is contained in:
Frappe Bot 2018-12-11 09:53:52 +00:00
commit c1ce84e9fc
10 changed files with 87 additions and 18 deletions

View file

@ -12,7 +12,7 @@ source_link = "https://github.com/frappe/frappe"
app_license = "MIT"
develop_version = '12.x.x-develop'
staging_version = '11.0.3-beta.35'
staging_version = '11.0.3-beta.36'
app_email = "info@frappe.io"

View file

@ -1,6 +1,7 @@
import frappe
def execute():
prepared_reports = frappe.get_all("Prepared Report")
for report in prepared_reports:
frappe.delete_doc("Prepared Report", report.name)
if frappe.db.table_exists('Prepared Report'):
prepared_reports = frappe.get_all("Prepared Report")
for report in prepared_reports:
frappe.delete_doc("Prepared Report", report.name)

View file

@ -34,7 +34,7 @@ class HiddenBlock extends Block {
}
}
HiddenBlock.blotName = 'hiddenblot';
HiddenBlock.tagName = 'DIV';
HiddenBlock.tagName = 'SPAN';
Quill.register(HiddenBlock, true);
// image uploader

View file

@ -78,10 +78,17 @@ frappe.ui.form.Timeline = class Timeline {
var selector = this.frm.doctype === "Communication"? ".btn-reply-email": ".btn-new-email";
this.email_button = this.wrapper.find(selector)
.on("click", function() {
const $btn = $(this);
let is_a_reply = true;
if ($btn.is('.btn-new-email')) {
is_a_reply = false;
}
var args = {
doc: me.frm.doc,
frm: me.frm,
recipients: me.get_recipient()
recipients: me.get_recipient(),
is_a_reply
}
if(me.frm.doctype === "Communication") {
@ -286,7 +293,8 @@ frappe.ui.form.Timeline = class Timeline {
txt: "",
title: __('Reply'),
frm: me.frm,
last_email: last_email
last_email: last_email,
is_a_reply: true
});
});
}
@ -336,7 +344,7 @@ frappe.ui.form.Timeline = class Timeline {
});
} else {
if(c.communication_type=="Communication" && c.communication_medium=="Email") {
c.content = c.content.split('<div data-comment="original-reply">')[0];
c.content = c.content.split('<span data-comment="original-reply" class="hidden">Reply To</span>')[0];
c.content = frappe.utils.strip_original_content(c.content);
c.original_content = c.content;

View file

@ -498,7 +498,9 @@ frappe.views.CommunicationComposer = Class.extend({
save_as_draft: function() {
if (this.dialog) {
try {
localStorage.setItem(this.frm.doctype + this.frm.docname, this.dialog.get_value('content'));
let message = this.dialog.get_value('content');
message = message.split('<span data-comment="original-reply" class="hidden">Reply To</span>')[0];
localStorage.setItem(this.frm.doctype + this.frm.docname, message);
} catch (e) {
// silently fail
console.log(e);
@ -621,7 +623,7 @@ frappe.views.CommunicationComposer = Class.extend({
signature = signature.replace(/\n/g, "<br>");
}
if (this.txt) {
if(this.txt) {
this.message = this.txt + (this.message ? ("<br><br>" + this.message) : "");
} else {
// saved draft in localStorage
@ -636,8 +638,50 @@ frappe.views.CommunicationComposer = Class.extend({
+ this.real_name + ",</p><!-- salutation-ends --><br>" + (this.message || "");
}
var reply = (this.message || "") + (signature ? ("<br>" + signature) : "");
let reply = (this.message || "") + (signature ? ("<br>" + signature) : "");
let content = '';
fields.content.set_value(reply);
if (this.is_a_reply === 'undefined') {
this.is_a_reply = true;
}
if (this.is_a_reply) {
let last_email = this.last_email;
if (!last_email) {
last_email = this.frm && this.frm.timeline.get_last_email(true);
}
if (!last_email) return;
let last_email_content = last_email.original_comment || last_email.content;
last_email_content = last_email_content
.replace(/&lt;meta[\s\S]*meta&gt;/g, '') // remove <meta> tags
.replace(/&lt;style[\s\S]*&lt;\/style&gt;/g, ''); // // remove <style> tags
// clip last email for a maximum of 20k characters
// to prevent the email content from getting too large
if (last_email_content.length > 20 * 1024) {
last_email_content += '<div>' + __('Message clipped') + '</div>' + last_email_content;
last_email_content = last_email_content.slice(0, 20 * 1024);
}
let communication_date = last_email.communication_date || last_email.creation;
content = `
<div><br></div>
${reply}
<div class="ql-collapse" data-collapse="true">
<span data-comment='original-reply'>Reply To</span>
<blockquote>
<p>${__("On {0}, {1} wrote:", [frappe.datetime.global_date_format(communication_date) , last_email.sender])}</p>
${last_email_content}
</blockquote>
</div>
`;
} else {
content = "<div><br></div>" + reply;
}
fields.content.set_value(content);
}
});

View file

@ -937,6 +937,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
this.$status = $(`<div class="form-message text-muted small"></div>`)
.hide().insertAfter(page_form);
this.show_tip();
this.$chart = $('<div class="chart-wrapper">').hide().appendTo(this.page.main);
this.$report = $('<div class="report-wrapper">').appendTo(this.page.main);
this.$message = $(this.message_div('')).hide().appendTo(this.page.main);
@ -950,6 +951,15 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
this.$status.hide();
}
show_tip() {
const part1 = __('For comparative filters, start with ">" or "<" or "=", e.g. >5 or =324');
const part2 = __('For ranges use ":", e.g. "5:10" (to filter values between 5 & 10');
this.page.footer.removeClass('hide').addClass('text-muted text-center').html(`
<p>${part1}</p>
<p>${part2}</p>
`);
}
message_div(message) {
return `<div class='flex justify-center align-center text-muted' style='height: 50vh;'>
<div>${message}</div>

View file

@ -53,6 +53,9 @@ class TestScheduler(TestCase):
"monthly", "monthly_long"])
frappe.db.set_global('enabled_scheduler_events', val)
# TEMP for debug: this test fails randomly
print('Setting enabled_scheduler_events {0}'.format(val))
# maintain last_event and next_event on different days
next_event = now_datetime().replace(hour=0, minute=0, second=0, microsecond=0)
last_event = next_event - relativedelta(hours=2)

View file

@ -214,10 +214,13 @@ def get_enabled_scheduler_events():
return frappe.flags.enabled_events
enabled_events = frappe.db.get_global("enabled_scheduler_events")
if frappe.flags.in_test:
# TEMP for debug: this test fails randomly
print('found enabled_scheduler_events {0}'.format(enabled_events))
if enabled_events:
if isinstance(enabled_events, string_types):
enabled_events = json.loads(enabled_events)
return enabled_events
return ["all", "hourly", "hourly_long", "daily", "daily_long",

View file

@ -22,7 +22,7 @@
"awesomplete": "^1.1.2",
"cookie": "^0.3.1",
"express": "^4.16.2",
"frappe-datatable": "^1.6.2",
"frappe-datatable": "^1.7.0",
"frappe-gantt": "^0.1.0",
"fuse.js": "^3.2.0",
"highlight.js": "^9.12.0",

View file

@ -1517,10 +1517,10 @@ forwarded@~0.1.2:
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=
frappe-datatable@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/frappe-datatable/-/frappe-datatable-1.6.2.tgz#4144e2e15740a8b90dfd133410384214ee882ff9"
integrity sha512-ES0wJnSa9LGCWpCDg7WKYeuHobWKsQJQn0t8rXvuscypg87BmW6EZAJRa1bL6E0HXrjyr7p5yNXH2LyUyiULkQ==
frappe-datatable@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/frappe-datatable/-/frappe-datatable-1.7.0.tgz#6cc950a69bdfd514fb61ab25b85fa68c3b33aee0"
integrity sha512-CcCIf36eJMqzobc4rMT75zCCFKjfghJAR9rXiAP6h2uWdDKhb0U+rDjiFPweS54lv19tpTYF7Q/1SSx0Ih+Mfg==
dependencies:
hyperlist "^1.0.0-beta"
lodash "^4.17.5"