mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 01:28:31 +02:00
more fixes
This commit is contained in:
@@ -133,7 +133,7 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
|
||||
function getTeaserInfo(next) {
|
||||
topics.get_teaser(topicData.tid, function(teaser) {
|
||||
topics.getTeaser(topicData.tid, function(teaser) {
|
||||
next(null, teaser);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ var RDB = require('./redis.js'),
|
||||
function(next) {
|
||||
|
||||
topics.getTopicField(tid, 'title', function(title) {
|
||||
topics.get_teaser(tid, function(teaser) {
|
||||
topics.getTeaser(tid, function(teaser) {
|
||||
notifications.create(teaser.username + ' has posted a reply to: "' + title + '"', null, '/topic/' + tid, 'topic:' + tid, function(nid) {
|
||||
next(null, nid);
|
||||
});
|
||||
|
||||
@@ -132,13 +132,13 @@ marked.setOptions({
|
||||
|
||||
Topics.getTopicForCategoryView = function(tid, uid, callback) {
|
||||
|
||||
function get_topic_data(next) {
|
||||
function getTopicData(next) {
|
||||
Topics.getTopicDataWithUsername(tid, function(topic) {
|
||||
next(null, topic);
|
||||
});
|
||||
}
|
||||
|
||||
function get_read_status(next) {
|
||||
function getReadStatus(next) {
|
||||
// posts.create calls this function - should be an option to skip this because its always true
|
||||
if (uid && parseInt(uid) > 0) {
|
||||
RDB.sismember(schema.topics(tid).read_by_uid, uid, function(err, read) {
|
||||
@@ -149,13 +149,13 @@ marked.setOptions({
|
||||
}
|
||||
}
|
||||
|
||||
function get_teaser(next) {
|
||||
Topics.get_teaser(tid, function(teaser) {
|
||||
function getTeaser(next) {
|
||||
Topics.getTeaser(tid, function(teaser) {
|
||||
next(null, teaser);
|
||||
});
|
||||
}
|
||||
|
||||
async.parallel([get_topic_data, get_read_status, get_teaser], function(err, results) {
|
||||
async.parallel([getTopicData, getReadStatus, getTeaser], function(err, results) {
|
||||
if (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
@@ -242,13 +242,13 @@ marked.setOptions({
|
||||
});
|
||||
}
|
||||
|
||||
Topics.get_teasers = function(tids, callback) {
|
||||
Topics.getTeasers = function(tids, callback) {
|
||||
var requests = [];
|
||||
if (Array.isArray(tids)) {
|
||||
for(x=0,numTids=tids.length;x<numTids;x++) {
|
||||
(function(tid) {
|
||||
requests.push(function(next) {
|
||||
Topics.get_teaser(tid, function(teaser_info) {
|
||||
Topics.getTeaser(tid, function(teaser_info) {
|
||||
next(null, teaser_info);
|
||||
});
|
||||
});
|
||||
@@ -282,7 +282,7 @@ marked.setOptions({
|
||||
|
||||
}
|
||||
|
||||
Topics.get_teaser = function(tid, callback) {
|
||||
Topics.getTeaser = function(tid, callback) {
|
||||
Topics.get_latest_undeleted_pid(tid, function(pid) {
|
||||
if (pid !== null) {
|
||||
|
||||
|
||||
@@ -294,33 +294,29 @@ var express = require('express'),
|
||||
app.get('/api/:method/:id/:section?', api_method);
|
||||
app.get('/api/:method/:id*', api_method);
|
||||
|
||||
app.get('/tid/:tid', function(req, res) {
|
||||
topics.getTopicData(req.params.tid, function(data){
|
||||
if(data)
|
||||
res.send(data);
|
||||
else
|
||||
res.send("Topic doesn't exist!");
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/pid/:pid', function(req, res) {
|
||||
posts.getPostData(req.params.pid, function(data){
|
||||
if(data)
|
||||
res.send(data);
|
||||
else
|
||||
res.send("Post doesn't exist!");
|
||||
});
|
||||
});
|
||||
|
||||
app.all('/test', function(req, res) {
|
||||
//res.send();
|
||||
|
||||
/*posts.getPostsByPids([1,2,3], 1, function(data) {
|
||||
res.send(data);
|
||||
});*/
|
||||
|
||||
/*posts.getPostsByTid(2, 0, -1, function(data) {
|
||||
res.send(data);
|
||||
});*/
|
||||
|
||||
/* posts.getPostsByPids([1,2,3], function(data) {
|
||||
res.send(data);
|
||||
});*/
|
||||
|
||||
/*posts.getPostsByUid(1, 0, 10, function(data) {
|
||||
res.send(data);
|
||||
});*/
|
||||
|
||||
topics.getTopicById(24, 1, function(data) {
|
||||
res.send(data);
|
||||
});
|
||||
|
||||
/* categories.getCategoryById(12, 0, function(returnData) {
|
||||
res.send(returnData);
|
||||
});
|
||||
*/
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user