Quellcode durchsuchen

clear cache on new comment

version-14
Rushabh Mehta vor 11 Jahren
Ursprung
Commit
84ff4b2308
4 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen
  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 Datei anzeigen

@@ -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()


+ 1
- 0
frappe/public/js/frappe/ui/toolbar/recent.js Datei anzeigen

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


+ 3
- 1
frappe/templates/includes/comments.py Datei anzeigen

@@ -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,


+ 1
- 1
frappe/templates/includes/contact.js Datei anzeigen

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


Laden…
Abbrechen
Speichern