From e023d0161641d833f847f0f0d790cabc1f2c3cd8 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 16 Jul 2015 14:07:28 -0400 Subject: [PATCH] closes #3327 --- src/posts/edit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/posts/edit.js b/src/posts/edit.js index 518cbe5763..d6fca5d738 100644 --- a/src/posts/edit.js +++ b/src/posts/edit.js @@ -8,10 +8,15 @@ var async = require('async'), privileges = require('../privileges'), plugins = require('../plugins'), cache = require('./cache'), + pubsub = require('../pubsub'), utils = require('../../public/src/utils'); module.exports = function(Posts) { + pubsub.on('post:edit', function(pid) { + cache.del(pid); + }); + Posts.edit = function(data, callback) { var now = Date.now(); var postData; @@ -58,7 +63,7 @@ module.exports = function(Posts) { editMainPost(data, postData, next); }, post: function(next) { - cache.del(postData.pid); + pubsub.publish('post:edit', postData.pid); Posts.parsePost(postData, next); } }, function(err, results) {