mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-04 06:40:44 +01:00
define all required data at top of fn
This commit is contained in:
@@ -19,7 +19,8 @@ module.exports = function(Topics) {
|
||||
Topics.create = function(data, callback) {
|
||||
var uid = data.uid,
|
||||
title = data.title,
|
||||
cid = data.cid;
|
||||
cid = data.cid,
|
||||
tags = data.tags;
|
||||
|
||||
db.incrObjectField('global', 'nextTid', function(err, tid) {
|
||||
if (err) {
|
||||
@@ -78,7 +79,7 @@ module.exports = function(Topics) {
|
||||
db.incrObjectField('global', 'topicCount', next);
|
||||
},
|
||||
function(next) {
|
||||
Topics.createTags(data.tags, tid, timestamp, next);
|
||||
Topics.createTags(tags, tid, timestamp, next);
|
||||
}
|
||||
], function(err) {
|
||||
if (err) {
|
||||
@@ -95,7 +96,8 @@ module.exports = function(Topics) {
|
||||
var uid = data.uid,
|
||||
title = data.title,
|
||||
content = data.content,
|
||||
cid = data.cid;
|
||||
cid = data.cid,
|
||||
tags = data.tags;
|
||||
|
||||
if (title) {
|
||||
title = title.trim();
|
||||
@@ -131,7 +133,7 @@ module.exports = function(Topics) {
|
||||
},
|
||||
function(filteredData, next) {
|
||||
content = filteredData.content || data.content;
|
||||
Topics.create({uid: uid, title: title, cid: cid, thumb: data.thumb, tags: data.tags}, next);
|
||||
Topics.create({uid: uid, title: title, cid: cid, thumb: data.thumb, tags: tags}, next);
|
||||
},
|
||||
function(tid, next) {
|
||||
Topics.reply({uid:uid, tid:tid, handle: data.handle, content:content, req: data.req}, next);
|
||||
|
||||
Reference in New Issue
Block a user