From a79ca2b13522cf9bc83cd85306471be59dee72a7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 24 Feb 2014 13:49:15 -0500 Subject: [PATCH 01/10] clean up ENDIF conditional if object.value is undefined and is used in an ELSE block --- public/src/templates.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/src/templates.js b/public/src/templates.js index 866e076302..086eca12c1 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -410,7 +410,8 @@ } else { // clean up all undefined conditionals template = template.replace(//gi, 'ENDIF -->') - .replace(//gi, ''); + .replace(//gi, '') + .replace(//gi, ''); } return template; From 71ea01edb7d6f1581a69ea0ff8da8997d950cf26 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 24 Feb 2014 13:49:47 -0500 Subject: [PATCH 02/10] switching topics.thumb conditional back --- public/templates/category.tpl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 0f4f97748a..c437ceac2d 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -43,11 +43,7 @@ todo: add a check for config.allowTopicsThumbnail if issue#1066 is a win --> - - - - - +

From acafa9095f6e49302238b83425493c209e554922 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 24 Feb 2014 14:28:09 -0500 Subject: [PATCH 03/10] added footer widget area to topic.tpl --- public/templates/topic.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 2bb43ff789..2a60224fe6 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -8,7 +8,6 @@ -
+ +
+ + {widgets.html} + +
\ No newline at end of file From cd9bd91ab2a453b1c92e1b5fc2a63f91d4660404 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 15:10:27 -0500 Subject: [PATCH 04/10] fixes double hashes in share links --- public/src/forum/topic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 33b6fbc4a2..8ebd8342d8 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -484,7 +484,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { $('#post-container').on('shown.bs.dropdown', '.share-dropdown', function() { var pid = $(this).parents('.post-row').attr('data-pid'); - $('#post_' + pid + '_link').val(window.location.href + "#" + pid); + $('#post_' + pid + '_link').val(window.location.protocol + '//' + window.location.host + window.location.pathname + '#' + pid); // without the setTimeout can't select the text in the input setTimeout(function() { $('#post_' + pid + '_link').putCursorAtEnd().select(); From 7c49c32ad311b812747068c02ef93658d15d4290 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 15:23:26 -0500 Subject: [PATCH 05/10] scroll fix --- public/src/forum/topic.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 8ebd8342d8..b42a970001 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1055,7 +1055,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { offset = 0; } - if($('#post_anchor_' + pid).length) { return scrollToPid(pid); } @@ -1093,8 +1092,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { tid = $('#post-container').attr('data-tid'); function animateScroll() { - $('window,html').animate({ - scrollTop: scrollTo.offset().top - $('#header-menu').height() - offset + $("html, body").animate({ + scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + "px" }, duration !== undefined ? duration : 400, function() { updateHeader(); }); From 0f8ee3a671cc7eb92b720ac90db6ada66853cc7f Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 15:45:30 -0500 Subject: [PATCH 06/10] added instructions class --- public/templates/composer.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/composer.tpl b/public/templates/composer.tpl index 795ce28517..584ba48153 100644 --- a/public/templates/composer.tpl +++ b/public/templates/composer.tpl @@ -75,7 +75,7 @@
[[topic:composer.drag_and_drop_images]]
-
+
[[topic:composer.content_is_parsed_with]] Markdown. [[topic:composer.upload_instructions]] From 9216b29b69dca2f5db9adc3be0444a270b027615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 24 Feb 2014 15:54:43 -0500 Subject: [PATCH 07/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0f317fc47..36c8253255 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # NodeBB -![Dependency Management powered by David.](https://david-dm.org/designcreateplay/NodeBB.png) +[![Dependency Status](https://david-dm.org/designcreateplay/nodebb.png)](https://david-dm.org/designcreateplay/nodebb) **NodeBB Forum Software** is powered by Node.js and built on a Redis database. It utilizes web sockets for instant interactions and real-time notifications. NodeBB is compatible down to IE8 and has many modern features out of the box such as social network integration and streaming discussions. From ed8e76ebced46d06b1691ec955ac0d90b2be914b Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 16:01:01 -0500 Subject: [PATCH 08/10] added error check to getTopicDataWithUser --- src/topics.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/topics.js b/src/topics.js index 51a7008ef9..ca7c134831 100644 --- a/src/topics.js +++ b/src/topics.js @@ -325,13 +325,13 @@ var async = require('async'), Topics.getTopicDataWithUser = function(tid, callback) { Topics.getTopicData(tid, function(err, topic) { - if(err) { - return callback(err, null); + if(err || !topic) { + return callback(err || new Error('topic doesn\'t exist')); } user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) { if(err) { - return callback(err, null); + return callback(err); } topic.username = userData.username; @@ -859,11 +859,7 @@ var async = require('async'), } function getReadStatus(next) { - if (uid && parseInt(uid, 10) > 0) { - Topics.hasReadTopic(tid, uid, next); - } else { - next(null, null); - } + Topics.hasReadTopic(tid, uid, next); } function getTeaser(next) { From 8feac114c37b29d6fc224d3db95e090dc73bd08f Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 16:23:11 -0500 Subject: [PATCH 09/10] closes #1022 --- src/threadTools.js | 10 +++------- src/topics.js | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/threadTools.js b/src/threadTools.js index b9fde04bc5..66269a9133 100644 --- a/src/threadTools.js +++ b/src/threadTools.js @@ -65,8 +65,6 @@ var winston = require('winston'), return callback(err); } - db.decrObjectField('global', 'topicCount'); - ThreadTools.lock(tid); Plugins.fireHook('action:topic.delete', tid); @@ -101,10 +99,10 @@ var winston = require('winston'), return callback(err); } - db.incrObjectField('global', 'topicCount'); - ThreadTools.unlock(tid); + Plugins.fireHook('action:topic.restore', tid); + events.logTopicRestore(uid, tid); websockets.emitTopicPostStats(); @@ -113,8 +111,6 @@ var winston = require('winston'), tid: tid }); - Plugins.fireHook('action:topic.restore', tid); - callback(null, { tid:tid }); @@ -134,7 +130,7 @@ var winston = require('winston'), tid: tid }); } - } + }; ThreadTools.unlock = function(tid, uid, callback) { topics.setTopicField(tid, 'locked', 0); diff --git a/src/topics.js b/src/topics.js index ca7c134831..5c2690c10a 100644 --- a/src/topics.js +++ b/src/topics.js @@ -1154,6 +1154,16 @@ var async = require('async'), }); } + Topics.updateTopicCount = function(callback) { + db.sortedSetCard('topics:recent', function(err, count) { + if(err) { + return callback(err); + } + + db.setObjectField('global', count, callback); + }); + }; + Topics.delete = function(tid, callback) { async.parallel([ function(next) { @@ -1176,7 +1186,13 @@ var async = require('async'), db.incrObjectFieldBy('category:' + cid, 'topic_count', -1, next); }); } - ], callback); + ], function(err) { + if (err) { + return callback(err); + } + + Topics.updateTopicCount(callback); + }); }; Topics.restore = function(tid, callback) { @@ -1206,7 +1222,13 @@ var async = require('async'), db.incrObjectFieldBy('category:' + cid, 'topic_count', 1, next); }); } - ], callback); + ], function(err) { + if (err) { + return callback(err); + } + + Topics.updateTopicCount(callback); + }); }); }; }(exports)); From bbc2df11e1fe69d2adbdd5027811ff545c07f752 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 24 Feb 2014 16:24:21 -0500 Subject: [PATCH 10/10] fixed updateTopicCount --- src/topics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/topics.js b/src/topics.js index 5c2690c10a..906dac90b9 100644 --- a/src/topics.js +++ b/src/topics.js @@ -1160,7 +1160,7 @@ var async = require('async'), return callback(err); } - db.setObjectField('global', count, callback); + db.setObjectField('global', 'topicCount', count, callback); }); };