run npm install. starting rss atom feeds of topics. fixed bug in topics where new topics created were not being saved properly

v1.18.x
psychobunny
parent 501cda24de
commit bcc903ee1c

@ -28,7 +28,9 @@
"bcrypt": "0.7.5", "bcrypt": "0.7.5",
"node-gyp": "0.9.5", "node-gyp": "0.9.5",
"async": "0.2.8", "async": "0.2.8",
"node-imagemagick": "0.1.8" "node-imagemagick": "0.1.8",
"atom-writer": "1.0.3",
"xml-writer": "1.2.4"
}, },
"devDependencies": {}, "devDependencies": {},
"optionalDependencies": {}, "optionalDependencies": {},

@ -6,6 +6,7 @@ var RDB = require('./redis.js'),
favourites = require('./favourites.js'), favourites = require('./favourites.js'),
config = require('../config.js'), config = require('../config.js'),
threadTools = require('./threadTools.js'), threadTools = require('./threadTools.js'),
feed = require('./feed.js'),
async = require('async'); async = require('async');
marked.setOptions({ marked.setOptions({
@ -256,12 +257,14 @@ marked.setOptions({
RDB.incr('tid:' + tid + ':postcount'); RDB.incr('tid:' + tid + ':postcount');
user.getUserFields(uid, ['username'], function(data) { // todo parallel
user.getUserFields(uid, ['username'], function(data) {
//add active users to this category //add active users to this category
RDB.get('tid:' + tid + ':cid', function(err, cid) { RDB.get('tid:' + tid + ':cid', function(err, cid) {
RDB.handle(err); RDB.handle(err);
feed.updateTopic(tid, cid);
// this is a bit of a naive implementation, defn something to look at post-MVP // this is a bit of a naive implementation, defn something to look at post-MVP
RDB.scard('cid:' + cid + ':active_users', function(amount) { RDB.scard('cid:' + cid + ':active_users', function(amount) {
if (amount > 10) { if (amount > 10) {

@ -24,6 +24,7 @@ marked.setOptions({
.get(schema.topics(tid).category_slug) .get(schema.topics(tid).category_slug)
.get(schema.topics(tid).deleted) .get(schema.topics(tid).deleted)
.get(schema.topics(tid).pinned) .get(schema.topics(tid).pinned)
.get(schema.topics(tid).slug)
.exec(function(err, replies) { .exec(function(err, replies) {
next(null, { next(null, {
topic_name: replies[0], topic_name: replies[0],
@ -31,7 +32,8 @@ marked.setOptions({
category_name: replies[2], category_name: replies[2],
category_slug: replies[3], category_slug: replies[3],
deleted: replies[4] || 0, deleted: replies[4] || 0,
pinned: replies[5] || 0 pinned: replies[5] || 0,
slug: replies[6]
}); });
}); });
} }
@ -105,6 +107,7 @@ marked.setOptions({
'locked': parseInt(topicData.locked) || 0, 'locked': parseInt(topicData.locked) || 0,
'deleted': parseInt(topicData.deleted) || 0, 'deleted': parseInt(topicData.deleted) || 0,
'pinned': parseInt(topicData.pinned) || 0, 'pinned': parseInt(topicData.pinned) || 0,
'slug': topicData.slug,
'topic_id': tid, 'topic_id': tid,
'expose_tools': privileges.editable ? 1 : 0, 'expose_tools': privileges.editable ? 1 : 0,
'posts': retrieved_posts, 'posts': retrieved_posts,
@ -322,21 +325,21 @@ marked.setOptions({
var slug = tid + '/' + utils.slugify(title); var slug = tid + '/' + utils.slugify(title);
// Topic Info // Topic Info
RDB.set(schema.topic(tid).title, title); RDB.set(schema.topics(tid).title, title);
RDB.set(schema.topic(tid).uid, uid); RDB.set(schema.topics(tid).uid, uid);
RDB.set(schema.topic(tid).slug, slug); RDB.set(schema.topics(tid).slug, slug);
RDB.set(schema.topic(tid).timestamp, new Date().getTime()); RDB.set(schema.topics(tid).timestamp, new Date().getTime());
RDB.set(schema.topic().slug(slug).tid, tid); RDB.set(schema.topics().slug(slug).tid, tid);
// Posts // Posts
posts.create(uid, tid, content, function(pid) { posts.create(uid, tid, content, function(pid) {
if (pid > 0) { if (pid > 0) {
RDB.lpush(schema.topic(tid).posts, pid); RDB.lpush(schema.topics(tid).posts, pid);
// Notify any users looking at the category that a new topic has arrived // Notify any users looking at the category that a new topic has arrived
Topics.get_topic(tid, uid, function(topicData) { Topics.get_topics(tid, uid, function(topicData) {
io.sockets.in('category_' + category_id).emit('event:new_topic', topicData); io.sockets.in('category_' + category_id).emit('event:new_topic', topicData);
}); });
} }

Loading…
Cancel
Save