From afb62c74849093b19b592873d0eba9febef00a1d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 17 Jul 2014 17:48:24 -0400 Subject: [PATCH] optional timestamp to post.create --- src/posts.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/posts.js b/src/posts.js index 6c96d2602f..d4d0ecdba1 100644 --- a/src/posts.js +++ b/src/posts.js @@ -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);