From 7d7ead3f478c3478b5adc56f22b987b5354c1ab0 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Wed, 27 Nov 2013 12:39:07 -0500 Subject: [PATCH 1/5] fixed js error in recent.js, remove content assignment --- public/src/forum/unread.js | 2 +- src/posts.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index 6dd8ae270c..a21a251f6c 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -3,7 +3,7 @@ define(function() { loadingMoreTopics = false; Unread.init = function() { - app.enter_room('recent_posts'); + app.enterRoom('recent_posts'); ajaxify.register_events([ 'event:new_topic', diff --git a/src/posts.js b/src/posts.js index 65258abcae..fa4433b6bd 100644 --- a/src/posts.js +++ b/src/posts.js @@ -43,14 +43,12 @@ var RDB = require('./redis.js'), return callback(err, null); } - content = newContent; - var timestamp = Date.now(), postData = { 'pid': pid, 'uid': uid, 'tid': tid, - 'content': content, + 'content': newContent, 'timestamp': timestamp, 'reputation': 0, 'editor': '', From e3da005780fd0c5cc8618a52259401e819c748f4 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 27 Nov 2013 14:25:01 -0500 Subject: [PATCH 2/5] grouped the social buttons --- public/templates/topic.tpl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 9f4e87c43d..5c9e348eef 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -74,13 +74,18 @@ -
- - - - - - +
+
+ + + + +
+ +
+ + +
From 2d05a06e374bff46dc5438d8f4129618d2ace933 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 27 Nov 2013 14:25:58 -0500 Subject: [PATCH 3/5] fixed template var, oops --- public/templates/topic.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 5c9e348eef..64ad635ab9 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -83,8 +83,8 @@
- - + +
From 2148f6ff95577e27d55ab25c1c37fe686b6ae3d0 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 27 Nov 2013 15:02:09 -0500 Subject: [PATCH 4/5] closes #559 --- src/categories.js | 10 +++++----- src/plugins.js | 13 +++++++++---- src/topics.js | 14 +++++++------- src/user.js | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/categories.js b/src/categories.js index 1a5eac3022..50c659c980 100644 --- a/src/categories.js +++ b/src/categories.js @@ -149,7 +149,7 @@ var RDB = require('./redis.js'), if(cids && cids.length === 0) { return callback(null, {categories : []}); } - + Categories.getCategories(cids, current_user, callback); }); }; @@ -322,12 +322,12 @@ var RDB = require('./redis.js'), RDB.hmgetObject('category:' + cid, fields, callback); }; - Categories.setCategoryField = function(cid, field, value) { - RDB.hset('category:' + cid, field, value); + Categories.setCategoryField = function(cid, field, value, callback) { + RDB.hset('category:' + cid, field, value, callback); }; - Categories.incrementCategoryFieldBy = function(cid, field, value) { - RDB.hincrby('category:' + cid, field, value); + Categories.incrementCategoryFieldBy = function(cid, field, value, callback) { + RDB.hincrby('category:' + cid, field, value, callback); }; Categories.getCategories = function(cids, uid, callback) { diff --git a/src/plugins.js b/src/plugins.js index c87b19462a..2a9bc7f9b2 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -202,9 +202,12 @@ var fs = require('fs'), break; case 'action': async.each(hookList, function(hookObj) { - if (hookObj.method) hookObj.method.call(_self.libraries[hookObj.id], args); - else { - if (global.env === 'development') winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); + if (hookObj.method) { + hookObj.method.call(_self.libraries[hookObj.id], args); + } else { + if (global.env === 'development') { + winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); + } } }); break; @@ -215,7 +218,9 @@ var fs = require('fs'), } else { // Otherwise, this hook contains no methods var returnVal = args; - if (callback) callback(null, returnVal); + if (callback) { + callback(null, returnVal); + } } }, isActive: function(id, callback) { diff --git a/src/topics.js b/src/topics.js index 3e026a0747..e9b05928b3 100644 --- a/src/topics.js +++ b/src/topics.js @@ -676,7 +676,7 @@ var RDB = require('./redis.js'), user.notifications.getUnreadByUniqueId(uid, 'topic:' + tid, function(err, nids) { notifications.mark_read_multiple(nids, uid, function() { - + }); }); } @@ -781,16 +781,16 @@ var RDB = require('./redis.js'), RDB.hmgetObject('topic:' + tid, fields, callback); } - Topics.setTopicField = function(tid, field, value) { - RDB.hset('topic:' + tid, field, value); + Topics.setTopicField = function(tid, field, value, callback) { + RDB.hset('topic:' + tid, field, value, callback); } - Topics.increasePostCount = function(tid) { - RDB.hincrby('topic:' + tid, 'postcount', 1); + Topics.increasePostCount = function(tid, callback) { + RDB.hincrby('topic:' + tid, 'postcount', 1, callback); } - Topics.increaseViewCount = function(tid) { - RDB.hincrby('topic:' + tid, 'viewcount', 1); + Topics.increaseViewCount = function(tid, callback) { + RDB.hincrby('topic:' + tid, 'viewcount', 1, callback); } Topics.isLocked = function(tid, callback) { diff --git a/src/user.js b/src/user.js index 78a450c12b..b96bec64e6 100644 --- a/src/user.js +++ b/src/user.js @@ -316,8 +316,8 @@ var bcrypt = require('bcrypt'), RDB.hset('user:' + uid, field, value, callback); }; - User.setUserFields = function(uid, data) { - RDB.hmset('user:' + uid, data); + User.setUserFields = function(uid, data, callback) { + RDB.hmset('user:' + uid, data, callback); }; User.incrementUserFieldBy = function(uid, field, value, callback) { From c860df79753fffced0e8e6e2a126e02d6b843a0d Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 27 Nov 2013 15:03:36 -0500 Subject: [PATCH 5/5] more #559 --- src/posts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/posts.js b/src/posts.js index fa4433b6bd..865e905041 100644 --- a/src/posts.js +++ b/src/posts.js @@ -342,13 +342,13 @@ var RDB = require('./redis.js'), }); } - Posts.setPostField = function(pid, field, value, done) { - RDB.hset('post:' + pid, field, value); + Posts.setPostField = function(pid, field, value, callback) { + RDB.hset('post:' + pid, field, value, callback); plugins.fireHook('action:post.setField', { 'pid': pid, 'field': field, 'value': value - }, done); + }); } Posts.getPostsByPids = function(pids, callback) {