Skip to content

Node.js based forum software built for the modern web

more fixes

Baris Usakli9c3046b89b9f
diff --git a/src/categories.js b/src/categories.js
index 68f7b65e5b..989d9efcb1 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -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);
});
}
diff --git a/src/threadTools.js b/src/threadTools.js
index e3c0cb49e8..c424564ace 100644
--- a/src/threadTools.js
+++ b/src/threadTools.js
@@ -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);
});
diff --git a/src/topics.js b/src/topics.js
index ec8a91acc7..23e7dc3e08 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -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) {
diff --git a/src/webserver.js b/src/webserver.js
index 1fd5bdc085..0d054f4e43 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -294,33 +294,29 @@ var express = require('express'),
app.get('/api/:method/:id/:section?', api_method);
app.get('/api/:method/:id*', api_method);
- 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);
- });*/
+ 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!");
+ });
+ });
-/* posts.getPostsByPids([1,2,3], function(data) {
- res.send(data);
- });*/
+ 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!");
+ });
+ });
- /*posts.getPostsByUid(1, 0, 10, function(data) {
- res.send(data);
- });*/
+ app.all('/test', function(req, res) {
topics.getTopicById(24, 1, function(data) {
res.send(data);
});
-
-/* categories.getCategoryById(12, 0, function(returnData) {
- res.send(returnData);
- });
-*/
});