more fixes

v1.18.x
Baris Usakli 12 years ago
parent 98013536d1
commit 9c3046b89b

@ -133,7 +133,7 @@ var RDB = require('./redis.js'),
} }
function getTeaserInfo(next) { function getTeaserInfo(next) {
topics.get_teaser(topicData.tid, function(teaser) { topics.getTeaser(topicData.tid, function(teaser) {
next(null, teaser); next(null, teaser);
}); });
} }

@ -235,7 +235,7 @@ var RDB = require('./redis.js'),
function(next) { function(next) {
topics.getTopicField(tid, 'title', function(title) { 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) { notifications.create(teaser.username + ' has posted a reply to: "' + title + '"', null, '/topic/' + tid, 'topic:' + tid, function(nid) {
next(null, nid); next(null, nid);
}); });

@ -132,13 +132,13 @@ marked.setOptions({
Topics.getTopicForCategoryView = function(tid, uid, callback) { Topics.getTopicForCategoryView = function(tid, uid, callback) {
function get_topic_data(next) { function getTopicData(next) {
Topics.getTopicDataWithUsername(tid, function(topic) { Topics.getTopicDataWithUsername(tid, function(topic) {
next(null, 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 // posts.create calls this function - should be an option to skip this because its always true
if (uid && parseInt(uid) > 0) { if (uid && parseInt(uid) > 0) {
RDB.sismember(schema.topics(tid).read_by_uid, uid, function(err, read) { RDB.sismember(schema.topics(tid).read_by_uid, uid, function(err, read) {
@ -149,13 +149,13 @@ marked.setOptions({
} }
} }
function get_teaser(next) { function getTeaser(next) {
Topics.get_teaser(tid, function(teaser) { Topics.getTeaser(tid, function(teaser) {
next(null, 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) { if (err) {
throw new Error(err); throw new Error(err);
} }
@ -242,13 +242,13 @@ marked.setOptions({
}); });
} }
Topics.get_teasers = function(tids, callback) { Topics.getTeasers = function(tids, callback) {
var requests = []; var requests = [];
if (Array.isArray(tids)) { if (Array.isArray(tids)) {
for(x=0,numTids=tids.length;x<numTids;x++) { for(x=0,numTids=tids.length;x<numTids;x++) {
(function(tid) { (function(tid) {
requests.push(function(next) { requests.push(function(next) {
Topics.get_teaser(tid, function(teaser_info) { Topics.getTeaser(tid, function(teaser_info) {
next(null, 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) { Topics.get_latest_undeleted_pid(tid, function(pid) {
if (pid !== null) { if (pid !== null) {

@ -294,33 +294,29 @@ var express = require('express'),
app.get('/api/:method/:id/:section?', api_method); app.get('/api/:method/:id/:section?', api_method);
app.get('/api/:method/:id*', api_method); app.get('/api/:method/:id*', api_method);
app.all('/test', function(req, res) { app.get('/tid/:tid', function(req, res) {
//res.send(); topics.getTopicData(req.params.tid, function(data){
if(data)
/*posts.getPostsByPids([1,2,3], 1, function(data) { res.send(data);
res.send(data); else
});*/ res.send("Topic doesn't exist!");
});
/*posts.getPostsByTid(2, 0, -1, function(data) { });
res.send(data);
});*/
/* posts.getPostsByPids([1,2,3], function(data) { app.get('/pid/:pid', function(req, res) {
res.send(data); posts.getPostData(req.params.pid, function(data){
});*/ if(data)
res.send(data);
else
res.send("Post doesn't exist!");
});
});
/*posts.getPostsByUid(1, 0, 10, function(data) { app.all('/test', function(req, res) {
res.send(data);
});*/
topics.getTopicById(24, 1, function(data) { topics.getTopicById(24, 1, function(data) {
res.send(data); res.send(data);
}); });
/* categories.getCategoryById(12, 0, function(returnData) {
res.send(returnData);
});
*/
}); });

Loading…
Cancel
Save