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. diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 33b6fbc4a2..b42a970001 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(); @@ -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(); }); 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; 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 --> - - - - - +

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]] 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 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 51a7008ef9..906dac90b9 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) { @@ -1158,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', 'topicCount', count, callback); + }); + }; + Topics.delete = function(tid, callback) { async.parallel([ function(next) { @@ -1180,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) { @@ -1210,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));