updated lru to latest
created new files posts/cache.js posts/parse.js posts/edit.js
This commit is contained in:
barisusakli
2015-04-20 17:56:43 -04:00
parent eb0e2fe75d
commit 1f06f90a50
14 changed files with 238 additions and 205 deletions

33
src/posts/parse.js Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
var cache = require('./cache'),
plugins = require('../plugins');
module.exports = function(Posts) {
Posts.parsePost = function(postData, callback) {
postData.content = postData.content || '';
var cachedContent = cache.get(postData.pid);
if (cachedContent) {
postData.content = cachedContent;
return callback(null, postData);
}
plugins.fireHook('filter:parse.post', {postData: postData}, function(err, data) {
if (err) {
return callback(err);
}
cache.set(data.postData.pid, data.postData.content);
callback(null, data.postData);
});
};
Posts.parseSignature = function(userData, uid, callback) {
userData.signature = userData.signature || '';
plugins.fireHook('filter:parse.signature', {userData: userData, uid: uid}, callback);
};
};