From 740cf13e8d76ebd51cc7469f8755b8ba8e042c8b Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 11 Jun 2013 13:58:02 -0400 Subject: [PATCH] updated less-middleware to 1.1.12 (fixing odd regression with LESS package update). Fixed issue where editing of posts was wonky because the title was being grabbed incorrectly --- package.json | 2 +- src/topics.js | 11 +++++++++++ src/websockets.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6dd89d58ee..6ce01eec26 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "passport-twitter": "0.1.4", "passport-google-oauth": "0.1.5", "passport-facebook": "0.1.5", - "less-middleware": "0.1.11", + "less-middleware": "0.1.12", "marked": "0.2.8", "bcrypt": "0.7.5", "node-gyp": "0.9.5", diff --git a/src/topics.js b/src/topics.js index 787eade2e4..7a9d5f5923 100644 --- a/src/topics.js +++ b/src/topics.js @@ -206,10 +206,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); diff --git a/src/websockets.js b/src/websockets.js index 5c222d8787..2e4baad28e 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -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); }); }