@@ -3,6 +3,7 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
import frappe, json | import frappe, json | ||||
from frappe.website.render import clear_cache | |||||
class DocType: | class DocType: | ||||
def __init__(self, d, dl): | def __init__(self, d, dl): | ||||
@@ -53,6 +54,13 @@ class DocType: | |||||
# use sql, so that we do not mess with the timestamp | # use sql, so that we do not mess with the timestamp | ||||
frappe.db.sql("""update `tab%s` set `_comments`=%s where name=%s""" % (self.doc.comment_doctype, | frappe.db.sql("""update `tab%s` set `_comments`=%s where name=%s""" % (self.doc.comment_doctype, | ||||
"%s", "%s"), (json.dumps(_comments), self.doc.comment_docname)) | "%s", "%s"), (json.dumps(_comments), self.doc.comment_docname)) | ||||
# clear parent cache if route exists: | |||||
route = frappe.db.get_value("Website Route", {"ref_doctype": self.doc.comment_doctype, | |||||
"docname": self.doc.comment_docname}) | |||||
if route: | |||||
clear_cache(route) | |||||
def on_trash(self): | def on_trash(self): | ||||
_comments = self.get_comments_from_parent() | _comments = self.get_comments_from_parent() | ||||
@@ -48,6 +48,7 @@ frappe.ui.toolbar.RecentDocs = Class.extend({ | |||||
}, | }, | ||||
setup: function() { | setup: function() { | ||||
// add menu items | // add menu items | ||||
if(!profile) return; | |||||
var rlist = JSON.parse(profile.recent||"[]"); | var rlist = JSON.parse(profile.recent||"[]"); | ||||
var m = rlist.length; | var m = rlist.length; | ||||
@@ -43,9 +43,11 @@ def add_comment(args=None): | |||||
ifnull(unsubscribed, 0)=0""", (comment.doc.comment_doctype, comment.doc.comment_docname))] | ifnull(unsubscribed, 0)=0""", (comment.doc.comment_doctype, comment.doc.comment_docname))] | ||||
owner = frappe.db.get_value(comment.doc.comment_doctype, comment.doc.comment_docname, "owner") | owner = frappe.db.get_value(comment.doc.comment_doctype, comment.doc.comment_docname, "owner") | ||||
recipients = commentors if owner=="Administrator" else list(set(commentors + [owner])) | |||||
from frappe.utils.email_lib.bulk import send | from frappe.utils.email_lib.bulk import send | ||||
send(recipients=list(set(commentors + [owner])), | |||||
send(recipients=recipients, | |||||
doctype='Comment', | doctype='Comment', | ||||
email_field='comment_by', | email_field='comment_by', | ||||
subject='New Comment on %s: %s' % (comment.doc.comment_doctype, | subject='New Comment on %s: %s' % (comment.doc.comment_doctype, | ||||
@@ -26,7 +26,7 @@ $(document).ready(function() { | |||||
sender: email, | sender: email, | ||||
message: message, | message: message, | ||||
callback: function(r) { | callback: function(r) { | ||||
if(r.status==="okay") { | |||||
if(r.message==="okay") { | |||||
msgprint(r.message || "Thank you for your message.") | msgprint(r.message || "Thank you for your message.") | ||||
} else { | } else { | ||||
msgprint("There were errors"); | msgprint("There were errors"); | ||||