Browse Source

clear cache on new comment

version-14
Rushabh Mehta 11 years ago
parent
commit
84ff4b2308
4 changed files with 13 additions and 2 deletions
  1. +8
    -0
      frappe/core/doctype/comment/comment.py
  2. +1
    -0
      frappe/public/js/frappe/ui/toolbar/recent.js
  3. +3
    -1
      frappe/templates/includes/comments.py
  4. +1
    -1
      frappe/templates/includes/contact.js

+ 8
- 0
frappe/core/doctype/comment/comment.py View File

@@ -3,6 +3,7 @@

from __future__ import unicode_literals
import frappe, json
from frappe.website.render import clear_cache

class DocType:
def __init__(self, d, dl):
@@ -53,6 +54,13 @@ class DocType:
# 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,
"%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):
_comments = self.get_comments_from_parent()


+ 1
- 0
frappe/public/js/frappe/ui/toolbar/recent.js View File

@@ -48,6 +48,7 @@ frappe.ui.toolbar.RecentDocs = Class.extend({
},
setup: function() {
// add menu items
if(!profile) return;
var rlist = JSON.parse(profile.recent||"[]");
var m = rlist.length;


+ 3
- 1
frappe/templates/includes/comments.py View File

@@ -43,9 +43,11 @@ def add_comment(args=None):
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")
recipients = commentors if owner=="Administrator" else list(set(commentors + [owner]))
from frappe.utils.email_lib.bulk import send
send(recipients=list(set(commentors + [owner])),
send(recipients=recipients,
doctype='Comment',
email_field='comment_by',
subject='New Comment on %s: %s' % (comment.doc.comment_doctype,


+ 1
- 1
frappe/templates/includes/contact.js View File

@@ -26,7 +26,7 @@ $(document).ready(function() {
sender: email,
message: message,
callback: function(r) {
if(r.status==="okay") {
if(r.message==="okay") {
msgprint(r.message || "Thank you for your message.")
} else {
msgprint("There were errors");


Loading…
Cancel
Save