mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
optional timestamp to post.create
This commit is contained in:
12
src/posts.js
12
src/posts.js
@@ -30,22 +30,20 @@ var async = require('async'),
|
|||||||
var uid = data.uid,
|
var uid = data.uid,
|
||||||
tid = data.tid,
|
tid = data.tid,
|
||||||
content = data.content,
|
content = data.content,
|
||||||
toPid = data.toPid;
|
timestamp = data.timestamp || Date.now();
|
||||||
|
|
||||||
|
|
||||||
if (uid === null) {
|
if (uid === null) {
|
||||||
return callback(new Error('[[error:invalid-uid]]'));
|
return callback(new Error('[[error:invalid-uid]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var timestamp = Date.now(),
|
|
||||||
postData;
|
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
db.incrObjectField('global', 'nextPid', next);
|
db.incrObjectField('global', 'nextPid', next);
|
||||||
},
|
},
|
||||||
function(pid, next) {
|
function(pid, next) {
|
||||||
|
|
||||||
postData = {
|
var postData = {
|
||||||
'pid': pid,
|
'pid': pid,
|
||||||
'uid': uid,
|
'uid': uid,
|
||||||
'tid': tid,
|
'tid': tid,
|
||||||
@@ -58,8 +56,8 @@ var async = require('async'),
|
|||||||
'deleted': 0
|
'deleted': 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (toPid) {
|
if (data.toPid) {
|
||||||
postData.toPid = toPid;
|
postData.toPid = data.toPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.fireHook('filter:post.save', postData, next);
|
plugins.fireHook('filter:post.save', postData, next);
|
||||||
|
|||||||
Reference in New Issue
Block a user