mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -12,7 +12,6 @@ var categories = require('../categories');
|
||||
var utils = require('../../public/src/utils');
|
||||
|
||||
module.exports = function (Posts) {
|
||||
|
||||
Posts.create = function (data, callback) {
|
||||
// This is an internal method, consider using Topics.reply instead
|
||||
var uid = data.uid;
|
||||
@@ -36,14 +35,13 @@ module.exports = function (Posts) {
|
||||
db.incrObjectField('global', 'nextPid', next);
|
||||
},
|
||||
function (pid, next) {
|
||||
|
||||
postData = {
|
||||
'pid': pid,
|
||||
'uid': uid,
|
||||
'tid': tid,
|
||||
'content': content,
|
||||
'timestamp': timestamp,
|
||||
'deleted': 0
|
||||
pid: pid,
|
||||
uid: uid,
|
||||
tid: tid,
|
||||
content: content,
|
||||
timestamp: timestamp,
|
||||
deleted: 0,
|
||||
};
|
||||
|
||||
if (data.toPid) {
|
||||
@@ -61,7 +59,7 @@ module.exports = function (Posts) {
|
||||
plugins.fireHook('filter:post.save', postData, next);
|
||||
},
|
||||
function (postData, next) {
|
||||
plugins.fireHook('filter:post.create', {post: postData, data: data}, next);
|
||||
plugins.fireHook('filter:post.create', { post: postData, data: data }, next);
|
||||
},
|
||||
function (data, next) {
|
||||
postData = data.post;
|
||||
@@ -93,12 +91,12 @@ module.exports = function (Posts) {
|
||||
}
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', timestamp, postData.pid),
|
||||
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies')
|
||||
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies'),
|
||||
], next);
|
||||
},
|
||||
function (next) {
|
||||
db.incrObjectField('global', 'postCount', next);
|
||||
}
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -110,9 +108,8 @@ module.exports = function (Posts) {
|
||||
postData.isMain = isMain;
|
||||
plugins.fireHook('action:post.save', {post: _.clone(postData)});
|
||||
next(null, postData);
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user