diff --git a/package.json b/package.json index 72e0ad08c3..341011636a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,9 @@ "bcrypt": "0.7.5", "node-gyp": "0.9.5", "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": {}, "optionalDependencies": {}, diff --git a/src/posts.js b/src/posts.js index 58bdce5d36..7cc19c5c8c 100644 --- a/src/posts.js +++ b/src/posts.js @@ -6,6 +6,7 @@ var RDB = require('./redis.js'), favourites = require('./favourites.js'), config = require('../config.js'), threadTools = require('./threadTools.js'), + feed = require('./feed.js'), async = require('async'); marked.setOptions({ @@ -256,12 +257,14 @@ marked.setOptions({ RDB.incr('tid:' + tid + ':postcount'); - - user.getUserFields(uid, ['username'], function(data) { + user.getUserFields(uid, ['username'], function(data) { // todo parallel //add active users to this category RDB.get('tid:' + tid + ':cid', function(err, cid) { RDB.handle(err); + + feed.updateTopic(tid, cid); + // this is a bit of a naive implementation, defn something to look at post-MVP RDB.scard('cid:' + cid + ':active_users', function(amount) { if (amount > 10) { diff --git a/src/topics.js b/src/topics.js index 82f353cc3e..c6e0732fef 100644 --- a/src/topics.js +++ b/src/topics.js @@ -24,6 +24,7 @@ marked.setOptions({ .get(schema.topics(tid).category_slug) .get(schema.topics(tid).deleted) .get(schema.topics(tid).pinned) + .get(schema.topics(tid).slug) .exec(function(err, replies) { next(null, { topic_name: replies[0], @@ -31,7 +32,8 @@ marked.setOptions({ category_name: replies[2], category_slug: replies[3], 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, 'deleted': parseInt(topicData.deleted) || 0, 'pinned': parseInt(topicData.pinned) || 0, + 'slug': topicData.slug, 'topic_id': tid, 'expose_tools': privileges.editable ? 1 : 0, 'posts': retrieved_posts, @@ -322,21 +325,21 @@ marked.setOptions({ var slug = tid + '/' + utils.slugify(title); // Topic Info - RDB.set(schema.topic(tid).title, title); - RDB.set(schema.topic(tid).uid, uid); - RDB.set(schema.topic(tid).slug, slug); - RDB.set(schema.topic(tid).timestamp, new Date().getTime()); + RDB.set(schema.topics(tid).title, title); + RDB.set(schema.topics(tid).uid, uid); + RDB.set(schema.topics(tid).slug, slug); + 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.create(uid, tid, content, function(pid) { 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 - 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); }); }