optional timestamp to post.create

v1.18.x
barisusakli 11 years ago
parent 7401744112
commit afb62c7484

@ -30,22 +30,20 @@ var async = require('async'),
var uid = data.uid,
tid = data.tid,
content = data.content,
toPid = data.toPid;
timestamp = data.timestamp || Date.now();
if (uid === null) {
return callback(new Error('[[error:invalid-uid]]'));
}
var timestamp = Date.now(),
postData;
async.waterfall([
function(next) {
db.incrObjectField('global', 'nextPid', next);
},
function(pid, next) {
postData = {
var postData = {
'pid': pid,
'uid': uid,
'tid': tid,
@ -58,8 +56,8 @@ var async = require('async'),
'deleted': 0
};
if (toPid) {
postData.toPid = toPid;
if (data.toPid) {
postData.toPid = data.toPid;
}
plugins.fireHook('filter:post.save', postData, next);

Loading…
Cancel
Save