mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-31 03:18:03 +02:00
Merge remote-tracking branch 'origin'
This commit is contained in:
@@ -27,7 +27,9 @@ var RDB = require('./redis.js'),
|
||||
|
||||
var categoryData = {
|
||||
'category_name' : category_name,
|
||||
'show_category_features' : 'show',
|
||||
'show_sidebar' : 'show',
|
||||
'show_topic_button': 'show',
|
||||
'no_topics_message': 'hidden',
|
||||
'topic_row_size': 'span9',
|
||||
'category_id': category_id,
|
||||
'active_users': active_users,
|
||||
@@ -50,6 +52,8 @@ var RDB = require('./redis.js'),
|
||||
getModerators(function(err, moderators) {
|
||||
categoryData.moderator_block_class = moderators.length > 0 ? '' : 'none';
|
||||
categoryData.moderators = moderators;
|
||||
categoryData.show_sidebar = 'hidden';
|
||||
categoryData.no_topics_message = 'show';
|
||||
|
||||
callback(categoryData);
|
||||
});
|
||||
@@ -70,7 +74,9 @@ var RDB = require('./redis.js'),
|
||||
RDB.zrange('topics:recent', 0, -1, function(err, tids) {
|
||||
var latestTopics = {
|
||||
'category_name' : 'Recent',
|
||||
'show_category_features' : 'hidden',
|
||||
'show_sidebar' : 'hidden',
|
||||
'show_topic_button' : 'hidden',
|
||||
'no_topics_message' : 'hidden',
|
||||
'topic_row_size': 'span12',
|
||||
'category_id': false,
|
||||
'topics' : []
|
||||
|
||||
@@ -184,16 +184,6 @@ marked.setOptions({
|
||||
});
|
||||
}
|
||||
|
||||
Topics.get_posts_noscript = function(tid, current_user, callback) {
|
||||
// Topics.get_topic(tid, current_user, function() {
|
||||
callback([
|
||||
{
|
||||
foo: 'bar'
|
||||
}
|
||||
]);
|
||||
// });
|
||||
}
|
||||
|
||||
Topics.get_cid_by_tid = function(tid, callback) {
|
||||
RDB.get(schema.topics(tid).cid, function(err, cid) {
|
||||
if (cid && parseInt(cid) > 0) {
|
||||
@@ -206,10 +196,21 @@ marked.setOptions({
|
||||
|
||||
Topics.getTitle = function(tid, callback) {
|
||||
RDB.get('tid:' + tid + ':title', function(err, title) {
|
||||
console.log(tid, title);
|
||||
callback(title);
|
||||
});
|
||||
}
|
||||
|
||||
Topics.getTitleByPid = function(pid, callback) {
|
||||
RDB.get('pid:' + pid + ':tid', function(err, tid) {
|
||||
if (!err) {
|
||||
Topics.getTitle(tid, function(title) {
|
||||
callback(title);
|
||||
});
|
||||
} else callback('Could not grab title');
|
||||
});
|
||||
}
|
||||
|
||||
Topics.markAsRead = function(tid, uid) {
|
||||
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
||||
RDB.sadd(schema.topics(tid).read_by_uid, uid);
|
||||
|
||||
@@ -114,10 +114,10 @@ var express = require('express'),
|
||||
|
||||
|
||||
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
|
||||
topics.get_posts_noscript(tid, ((req.user) ? req.user.uid : 0), function(posts) {
|
||||
topics.getTopicById(tid, ((req.user) ? req.user.uid : 0), function(topic) {
|
||||
res.send(
|
||||
build_header() +
|
||||
'\n\t<noscript>\n\t\t' + templates['noscript/topic'] + '\n\t</noscript>' +
|
||||
'\n\t<noscript>\n' + templates['noscript/topic'].parse(topic) + '\n\t</noscript>' +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' +
|
||||
templates['footer']
|
||||
);
|
||||
|
||||
@@ -336,7 +336,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
topics.getTitle(data.pid, function(title) {
|
||||
topics.getTitleByPid(data.pid, function(title) {
|
||||
next(null, title);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user