From 97cb11628df67fe5c1999340be301a7870cadf70 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Sat, 1 Mar 2014 15:37:02 -0500 Subject: [PATCH 01/18] Installation instructions CentOS 6.5 ReadME.MD Adding installation instructions for CentOS 6.5, also adding npm strict-ssl to false to allow some npm packages that have self signed certs. --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab02209c57..cc34935b7f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ NodeBB requires the following software to be installed: * Redis, version 2.6 or greater **or** MongoDB, version 2.4 or greater * nginx, version 1.3.13 or greater (**only if** intending to use nginx to proxy requests to a NodeBB) -## Installation +## Installation Ubuntu First, we install our base software stack: @@ -57,7 +57,42 @@ Next, clone this repository: Obtain all of the dependencies required by NodeBB: $ cd nodebb + $ npm config set strict-ssl false $ npm install + $ npm config set strict-ssl true + +Initiate the setup script by running the app with the `--setup` flag: + + $ ./nodebb setup + +The default settings are for a local server running on the default port, with a redis store on the same machine/port. + +Lastly, we run the forum. + + $ ./nodebb start + +NodeBB can also be started with helper programs, such as `supervisor` and `forever`. [Take a look at the options here](https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB). + + +## Installation CentOS 6.5 + +First, we install our base software stack: + + # yum update + # yum groupinstall "Development Tools" -y + # yum install nodejs git redis ImageMagick + +Next, clone this repository: + + $ cd /path/to/nodebb/install/location + $ git clone git://github.com/designcreateplay/NodeBB.git nodebb + +Obtain all of the dependencies required by NodeBB: + + $ cd nodebb + $ npm config set strict-ssl false + $ npm install + $ npm config set strict-ssl true Initiate the setup script by running the app with the `--setup` flag: From e0dcf95138e1cc4e2a9c4516221ece179935e722 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 5 Mar 2014 21:19:36 -0500 Subject: [PATCH 02/18] fixed missing err in upgrade script --- src/upgrade.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index 9221d29cd0..12e7e610ab 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -197,17 +197,16 @@ Upgrade.upgrade = function(callback) { db.setAdd('plugins:active', 'nodebb-widget-essentials', function(err) { winston.info('[2014/2/20] Activating NodeBB Essential Widgets'); Plugins.reload(function() { - next(err); + if (err) { + next(err); + } else { + Upgrade.update(thisSchemaDate, next); + } }); }); } else { winston.info('[2014/2/20] Activating NodeBB Essential Widgets - skipped'); - - if (err) { - next(err); - } else { - Upgrade.update(thisSchemaDate, next); - } + next(); } }, function(next) { From e956c195878f2408f50f04c1516c66006a3b44ce Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 5 Mar 2014 21:21:53 -0500 Subject: [PATCH 03/18] #1110 - moved isEmailAvailable into User.email --- src/user.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/user.js b/src/user.js index 29065c7577..4674e1d17b 100644 --- a/src/user.js +++ b/src/user.js @@ -58,7 +58,7 @@ var bcrypt = require('bcryptjs'), }, function(next) { if (userData.email) { - User.isEmailAvailable(userData.email, function(err, available) { + User.email.available(userData.email, function(err, available) { if (err) { return next(err); } @@ -278,7 +278,7 @@ var bcrypt = require('bcryptjs'), return next(null, true); } - User.isEmailAvailable(data.email, function(err, available) { + User.email.available(data.email, function(err, available) { if (err) { return next(err, null); } @@ -422,12 +422,6 @@ var bcrypt = require('bcryptjs'), }); }; - User.isEmailAvailable = function(email, callback) { - db.isObjectField('email:uid', email, function(err, exists) { - callback(err, !exists); - }); - }; - User.changePassword = function(uid, data, callback) { if(!data || !data.uid) { return callback(new Error('invalid-uid')); @@ -1029,6 +1023,11 @@ var bcrypt = require('bcryptjs'), }); } }); + }, + available: function(email, callback) { + db.isObjectField('email:uid', email, function(err, exists) { + callback(err, !exists); + }); } }; From 3fe9bdc24cf59eadfcd54107fda9be577dc6aab7 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 6 Mar 2014 13:08:22 -0500 Subject: [PATCH 04/18] removed the postbar selector from activeusers --- public/src/forum/topic.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 6383cac823..a83e0493ce 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -622,7 +622,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { socket.on('get_users_in_room', function(data) { if(data && data.room.indexOf('topic') !== -1) { - var activeEl = $('li.post-bar[data-index="0"] .thread_active_users'); + var activeEl = $('.thread_active_users'); function createUserIcon(uid, picture, userslug, username) { if(!activeEl.find('[data-uid="' + uid + '"]').length) { @@ -694,11 +694,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { // Get users who are currently replying to the topic entered socket.emit('modules.composer.getUsersByTid', templates.get('topic_id'), function(err, uids) { - var activeUsersEl = $('.thread_active_users'), - x; if (uids && uids.length) { for(var x=0;x Date: Thu, 6 Mar 2014 13:32:26 -0500 Subject: [PATCH 05/18] closes #1167 --- public/src/forum/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/forum/login.js b/public/src/forum/login.js index 11afd12cdc..de0defd54a 100644 --- a/public/src/forum/login.js +++ b/public/src/forum/login.js @@ -52,7 +52,7 @@ define(function() { return false; }); - $('#content input').focus(); + $('#content #username').focus(); }; return Login; From 4986c8ed3af1f11a95807d9cf22a08fea7e6fcd7 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 6 Mar 2014 14:51:43 -0500 Subject: [PATCH 06/18] fixed tests --- mocks/databasemock.js | 22 +++++++++++------ src/database/mongo.js | 9 +------ src/database/redis.js | 6 ++--- src/meta.js | 3 +++ tests/topics.js | 56 ++++++++++++++++++++++++------------------- tests/user.js | 8 +++---- 6 files changed, 56 insertions(+), 48 deletions(-) diff --git a/mocks/databasemock.js b/mocks/databasemock.js index 89e5f850e7..abdf7fd97a 100644 --- a/mocks/databasemock.js +++ b/mocks/databasemock.js @@ -55,23 +55,31 @@ nconf.set(dbType, testDbConfig); - db = require('../src/database'); + var db = require('../src/database'), + meta = require('../src/meta'); before(function(done) { db.init(function(err) { //Clean up db.flushdb(function(err) { - if(err){ + if(err) { winston.error(err); throw new Error(err); } else { winston.info('test_database flushed'); - done(); + + + meta.configs.init(function () { + + var webserver = require('../src/webserver'), + sockets = require('../src/socket.io'); + + sockets.init(webserver.server); + + + done(); + }); } - - //TODO: data seeding, if needed at all - - }); }); }); diff --git a/src/database/mongo.js b/src/database/mongo.js index f568f3d514..af913ea9e1 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -166,15 +166,8 @@ module.flushdb = function(callback) { db.dropDatabase(function(err, result) { - if (err) { - winston.error(err.message); - if (typeof callback === 'function') { - return callback(err); - } - } - if (typeof callback === 'function') { - callback(); + callback(err); } }); }; diff --git a/src/database/redis.js b/src/database/redis.js index 4655eabb62..3892690a6f 100644 --- a/src/database/redis.js +++ b/src/database/redis.js @@ -117,11 +117,9 @@ module.flushdb = function(callback) { redisClient.send_command('flushdb', [], function(err) { - if (err) { - winston.error(err.message); - return callback(err); + if (typeof callback === 'function') { + callback(); } - callback(); }); }; diff --git a/src/meta.js b/src/meta.js index ce1cd70990..197351a11d 100644 --- a/src/meta.js +++ b/src/meta.js @@ -87,6 +87,9 @@ var fs = require('fs'), Meta.themes = { get: function (callback) { var themePath = nconf.get('themes_path'); + if (typeof themePath !== 'string') { + return callback(null, []); + } fs.readdir(themePath, function (err, files) { async.filter(files, function (file, next) { fs.stat(path.join(themePath, file), function (err, fileStat) { diff --git a/tests/topics.js b/tests/topics.js index 92404ee393..a028c1b274 100644 --- a/tests/topics.js +++ b/tests/topics.js @@ -1,31 +1,39 @@ -var winston = require('winston'); - -process.on('uncaughtException', function (err) { - winston.error('Encountered error while running test suite: ' + err.message); -}); +'use strict'; var assert = require('assert'), - db = require('../mocks/databasemock'); - - -var Topics = require('../src/topics'); + db = require('../mocks/databasemock'), + topics = require('../src/topics'), + categories = require('../src/categories'); describe('Topic\'s', function() { - var topic; + var topic, + categoryObj; - beforeEach(function(){ - topic = { - userId: 1, - categoryId: 1, - title: 'Test Topic Title', - content: 'The content of test topic' - }; + before(function(done) { + + categories.create({ + name: 'Test Category', + description: 'Test category created by testing script', + icon: 'fa-check', + blockclass: 'category-blue', + order: '5' + }, function(err, category) { + categoryObj = category; + + topic = { + userId: 1, + categoryId: categoryObj.cid, + title: 'Test Topic Title', + content: 'The content of test topic' + }; + done(); + }); }); describe('.post', function() { it('should create a new topic with proper parameters', function(done) { - Topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { + topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { assert.equal(err, null, 'was created with error'); assert.ok(result); @@ -34,9 +42,7 @@ describe('Topic\'s', function() { }); it('should fail to create new topic with wrong parameters', function(done) { - topic.userId = null; - - Topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { + topics.post({uid: null, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { assert.equal(err.message, 'invalid-user'); done(); }); @@ -47,8 +53,8 @@ describe('Topic\'s', function() { var newTopic; var newPost; - beforeEach(function(done){ - Topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { + beforeEach(function(done) { + topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { newTopic = result.topicData; newPost = result.postData; done(); @@ -57,13 +63,13 @@ describe('Topic\'s', function() { describe('.getTopicData', function() { it('should not receive errors', function(done) { - Topics.getTopicData(newTopic.tid, done); + topics.getTopicData(newTopic.tid, done); }); }); describe('.getTopicDataWithUser', function() { it('should not receive errors', function(done) { - Topics.getTopicDataWithUser(newTopic.tid, done); + topics.getTopicDataWithUser(newTopic.tid, done); }); }); }); diff --git a/tests/user.js b/tests/user.js index 40c7156cbd..5da9412802 100644 --- a/tests/user.js +++ b/tests/user.js @@ -16,7 +16,7 @@ describe('User', function() { beforeEach(function(){ userData = { - name: 'John Smith', + username: 'John Smith', password: 'swordfish', email: 'john@example.com', callback: undefined @@ -25,8 +25,8 @@ describe('User', function() { describe('when created', function() { - it('should be created properly', function(done){ - User.create({usename: userData.name, password: userData.password, email: userData.email}, function(error,userId){ + it('should be created properly', function(done) { + User.create({username: userData.username, password: userData.password, email: userData.email}, function(error,userId){ assert.equal(error, null, 'was created with error'); assert.ok(userId); done(); @@ -35,7 +35,7 @@ describe('User', function() { it('should have a valid email, if using an email', function() { assert.throws( - User.create({username: userData.name, password: userData.password, email: 'fakeMail'},function(){}), + User.create({username: userData.username, password: userData.password, email: 'fakeMail'},function(){}), Error, 'does not validate email' ); From da0e1a8eb91db0bdd6684e86f4b8792b45331687 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 6 Mar 2014 14:52:34 -0500 Subject: [PATCH 07/18] added back err to redis flushdb --- src/database/redis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/redis.js b/src/database/redis.js index 3892690a6f..d672994b6c 100644 --- a/src/database/redis.js +++ b/src/database/redis.js @@ -118,7 +118,7 @@ module.flushdb = function(callback) { redisClient.send_command('flushdb', [], function(err) { if (typeof callback === 'function') { - callback(); + callback(err); } }); }; From acd4771012cc578b84309a145fcc4fa222324d9e Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 6 Mar 2014 15:11:29 -0500 Subject: [PATCH 08/18] dbmock changes --- mocks/databasemock.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/mocks/databasemock.js b/mocks/databasemock.js index abdf7fd97a..7a2a11ca60 100644 --- a/mocks/databasemock.js +++ b/mocks/databasemock.js @@ -57,6 +57,7 @@ var db = require('../src/database'), meta = require('../src/meta'); + before(function(done) { db.init(function(err) { @@ -65,21 +66,18 @@ if(err) { winston.error(err); throw new Error(err); - } else { - winston.info('test_database flushed'); + } + winston.info('test_database flushed'); - meta.configs.init(function () { - - var webserver = require('../src/webserver'), - sockets = require('../src/socket.io'); + meta.configs.init(function () { + var webserver = require('../src/webserver'), + sockets = require('../src/socket.io'); sockets.init(webserver.server); - - done(); - }); - } + done(); + }); }); }); }); From d34e68ca25bb948bdf528eda1adbaf8b7d01e4ad Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 6 Mar 2014 15:31:10 -0500 Subject: [PATCH 09/18] convert score to int in mongo --- src/database/mongo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index af913ea9e1..a9cc09c2d4 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -544,8 +544,8 @@ value = value.toString(); } var data = { - score:score, - value:value + score: parseInt(score, 10), + value: value }; db.collection('objects').update({_key:key, value:value}, {$set:data}, {upsert:true, w: 1}, function(err, result) { From e9e53ad95ea0f5c757fda3669337daf8afc2ae8d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 15:32:06 -0500 Subject: [PATCH 10/18] added a new property to userData "hasPassword", disabling "current password" field in user editing if no password is set (for SSO logins, for example) --- public/src/forum/accountedit.js | 3 +-- public/templates/accountedit.tpl | 2 +- src/user.js | 24 +++++++++++++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index 13bab6cf9d..207785e846 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -189,8 +189,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) { password_confirm.on('blur', onPasswordConfirmChanged); $('#changePasswordBtn').on('click', function() { - - if (passwordvalid && passwordsmatch && (currentPassword.val() || app.isAdmin)) { + if ((passwordvalid && passwordsmatch) || app.isAdmin) { socket.emit('user.changePassword', { 'currentPassword': currentPassword.val(), 'newPassword': password.val(), diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl index acfe85af56..536943b7b5 100644 --- a/public/templates/accountedit.tpl +++ b/public/templates/accountedit.tpl @@ -115,7 +115,7 @@
- + disabled>
diff --git a/src/user.js b/src/user.js index 4674e1d17b..9d81f2ea71 100644 --- a/src/user.js +++ b/src/user.js @@ -185,8 +185,13 @@ var bcrypt = require('bcryptjs'), return callback(err); } - if (data && data.password) { - delete data.password; + if (data) { + if (data.password) { + delete data.password; + data.hasPassword = true; + } else { + data.hasPassword = false; + } } callback(err, data); }); @@ -467,13 +472,18 @@ var bcrypt = require('bcryptjs'), return callback(err); } - bcrypt.compare(data.currentPassword, currentPassword, function(err, res) { - if (err || !res) { - return callback(err || new Error('Your current password is not correct!')); - } + if (currentPassword !== null) { + bcrypt.compare(data.currentPassword, currentPassword, function(err, res) { + if (err || !res) { + return callback(err || new Error('Your current password is not correct!')); + } + hashAndSetPassword(callback); + }); + } else { + // No password in account (probably SSO login) hashAndSetPassword(callback); - }); + } }); } }; From b2bc1d4555d3282fbfb7ae33e292349fad5a98b6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 15:37:13 -0500 Subject: [PATCH 11/18] setting password to null in getUserData, because Object.delete is bad? :P (thanks @barisusakli) --- src/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user.js b/src/user.js index 9d81f2ea71..6b425fd401 100644 --- a/src/user.js +++ b/src/user.js @@ -187,7 +187,7 @@ var bcrypt = require('bcryptjs'), if (data) { if (data.password) { - delete data.password; + data.password = null; data.hasPassword = true; } else { data.hasPassword = false; From 958e85a31fcfb291e8861426c9da2b2077c3acef Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 15:56:14 -0500 Subject: [PATCH 12/18] updated readme to point to wiki for platform specific install docs --- README.md | 70 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index cc34935b7f..b45429cdf8 100644 --- a/README.md +++ b/README.md @@ -36,75 +36,9 @@ NodeBB requires the following software to be installed: * Redis, version 2.6 or greater **or** MongoDB, version 2.4 or greater * nginx, version 1.3.13 or greater (**only if** intending to use nginx to proxy requests to a NodeBB) -## Installation Ubuntu +## Installation -First, we install our base software stack: - - # apt-get install git nodejs redis-server build-essential imagemagick - -If you want to use MongoDB instead of Redis install it from http://www.mongodb.org/downloads and remove 'redis-server' from the above command. [MongoDB-Setup](https://github.com/designcreateplay/NodeBB/wiki/Installing-NodeBB-With-MongoDB) - -**If your package manager only installed a version of Node.js that is less than 0.8 (e.g. Ubuntu 12.10, 13.04):** - - # add-apt-repository ppa:chris-lea/node.js - # apt-get update && apt-get dist-upgrade - -Next, clone this repository: - - $ cd /path/to/nodebb/install/location - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb - -Obtain all of the dependencies required by NodeBB: - - $ cd nodebb - $ npm config set strict-ssl false - $ npm install - $ npm config set strict-ssl true - -Initiate the setup script by running the app with the `--setup` flag: - - $ ./nodebb setup - -The default settings are for a local server running on the default port, with a redis store on the same machine/port. - -Lastly, we run the forum. - - $ ./nodebb start - -NodeBB can also be started with helper programs, such as `supervisor` and `forever`. [Take a look at the options here](https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB). - - -## Installation CentOS 6.5 - -First, we install our base software stack: - - # yum update - # yum groupinstall "Development Tools" -y - # yum install nodejs git redis ImageMagick - -Next, clone this repository: - - $ cd /path/to/nodebb/install/location - $ git clone git://github.com/designcreateplay/NodeBB.git nodebb - -Obtain all of the dependencies required by NodeBB: - - $ cd nodebb - $ npm config set strict-ssl false - $ npm install - $ npm config set strict-ssl true - -Initiate the setup script by running the app with the `--setup` flag: - - $ ./nodebb setup - -The default settings are for a local server running on the default port, with a redis store on the same machine/port. - -Lastly, we run the forum. - - $ ./nodebb start - -NodeBB can also be started with helper programs, such as `supervisor` and `forever`. [Take a look at the options here](https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB). +[Please refer to platform-specific installation documentation](https://github.com/designcreateplay/NodeBB/wiki#wiki-installing-nodebb) ## Securing NodeBB From 588059042525f1996767c2755c569c76c2c3943c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 17:50:15 -0500 Subject: [PATCH 13/18] removing "pluginCSS", "css" in plugins is now included directly into stylesheet.css. This is a breaking change. fixes #1168 --- public/templates/header.tpl | 3 --- src/plugins.js | 21 +++++++-------------- src/routes/meta.js | 5 +++++ src/webserver.js | 1 - 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 9682271b8a..a391d9fd04 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -11,9 +11,6 @@ link="{linkTags.link}" rel="{linkTags.rel}" type="{linkTags.type}" href="{linkTags.href}" /> - - - diff --git a/src/plugins.js b/src/plugins.js index 40aa6b996e..32d902b03b 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -62,6 +62,8 @@ var fs = require('fs'), Plugins.loadedHooks = {}; Plugins.staticDirs = {}; Plugins.cssFiles.length = 0; + Plugins.lessFiles.length = 0; + Plugins.clientScripts.length = 0; // Read the list of activated plugins and require their libraries async.waterfall([ @@ -195,21 +197,12 @@ var fs = require('fs'), winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id); } - if (!pluginData.staticDir) { - Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { - return path.join('/plugins', file); - })); - } else { - winston.warn('[plugins/' + pluginData.id + '] staticDir is deprecated, define CSS files with new staticDirs instead.'); - Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { - return path.join('/plugins', pluginData.id, file); - })); - } - - next(); - } else { - next(); + Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { + return path.join(pluginData.id, file); + })); } + + next(); }, function(next) { // LESS files for plugins diff --git a/src/routes/meta.js b/src/routes/meta.js index cc5683b924..3b5fbed3f7 100644 --- a/src/routes/meta.js +++ b/src/routes/meta.js @@ -26,6 +26,11 @@ var path = require('path'), source += '\n@import "./' + plugins.lessFiles[x] + '";'; } + // ... and for each CSS file + for(x=0,numCSS=plugins.cssFiles.length;x Date: Thu, 6 Mar 2014 17:57:07 -0500 Subject: [PATCH 14/18] search page change --- public/src/forum/search.js | 6 ++++-- public/templates/search.tpl | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/src/forum/search.js b/public/src/forum/search.js index 3d3c72389e..e6cdcca11e 100644 --- a/public/src/forum/search.js +++ b/public/src/forum/search.js @@ -5,10 +5,12 @@ define(function() { var searchQuery = $('#topic-results').attr('data-search-query'); $('.search-result-text').each(function() { - var text = $(this).html(); + var result = $(this); + var text = result.html(); var regex = new RegExp(searchQuery, 'gi'); text = text.replace(regex, '' + searchQuery + ''); - $(this).html(text); + result.html(text); + result.find('img').addClass('img-responsive'); }); $('#search-form input').val(searchQuery); diff --git a/public/templates/search.tpl b/public/templates/search.tpl index ceb1082404..f1bdd76006 100644 --- a/public/templates/search.tpl +++ b/public/templates/search.tpl @@ -31,7 +31,7 @@ - {topics.title} +

{topics.title}

@@ -61,10 +61,13 @@
- - {posts.content} - + +

{posts.topic.title}

+
+
+ {posts.content} +
From 552a63367d8a811059768be9089ed081dee27768 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 19:48:38 -0500 Subject: [PATCH 15/18] workaround for problem arising from switch to Date.UTC() --- src/upgrade.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 12e7e610ab..9421180bf0 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -223,8 +223,11 @@ Upgrade.upgrade = function(callback) { } db.getListRange('categories:cid', 0, -1, function(err, cids) { + // Naive type-checking, becaue DBAL does not have .type() support if(err) { - return next(err); + // Most likely upgraded already. Skip. + winston.info('[2014/2/22] Added categories to sorted set - skipped'); + return Upgrade.update(thisSchemaDate, next); } if(!Array.isArray(cids)) { From 90b29031febbfbf93c84bdbf7e6051edebbc1ef2 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 20:36:05 -0500 Subject: [PATCH 16/18] backwards compatibility with older plugins using css with staticDir --- src/plugins.js | 14 ++++++++++++-- src/routes/meta.js | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 32d902b03b..d861f972fb 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -198,8 +198,18 @@ var fs = require('fs'), } Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) { - return path.join(pluginData.id, file); - })); + if (fs.existsSync(path.join(__dirname, '../node_modules', pluginData.id, file))) { + return path.join(pluginData.id, file); + } else { + // Backwards compatibility with < v0.4.0, remove this for v0.5.0 + if (pluginData.staticDir) { + return path.join(pluginData.id, pluginData.staticDir, file); + } else { + winston.error('[plugins/' + pluginData.id + '] This plugin\'s CSS is incorrectly configured, please contact the plugin author.'); + return null; + } + } + }).filter(function(path) { return path })); // Filter out nulls, remove this for v0.5.0 } next(); diff --git a/src/routes/meta.js b/src/routes/meta.js index 3b5fbed3f7..0629bc25a7 100644 --- a/src/routes/meta.js +++ b/src/routes/meta.js @@ -28,7 +28,7 @@ var path = require('path'), // ... and for each CSS file for(x=0,numCSS=plugins.cssFiles.length;x Date: Thu, 6 Mar 2014 20:53:41 -0500 Subject: [PATCH 17/18] set back to false when loading indicator fades out --- public/src/forum/topic.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index a83e0493ce..6ccb865b07 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1292,8 +1292,11 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { tid: tid, after: after }, function (err, data) { - infiniteLoaderActive = false; - indicatorEl.fadeOut(); + + indicatorEl.fadeOut(function() { + infiniteLoaderActive = false; + }); + if(err) { return app.alertError(err.message); } From c9642cecd2e72d2d6b8225dd3fbe4743bbcb2c02 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Mar 2014 23:24:47 -0500 Subject: [PATCH 18/18] setting Lavender as default theme for 0.4.0, woo! --- src/install.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/install.js b/src/install.js index 10ca8c39e6..dfd4cf994b 100644 --- a/src/install.js +++ b/src/install.js @@ -253,12 +253,6 @@ var async = require('async'), }, { field: 'chatMessagesToDisplay', value: 50 - }, { - field: 'theme:type', - value: 'local' - }, { - field: 'theme:id', - value: 'nodebb-theme-cerulean' }]; async.each(defaults, function (configObj, next) { @@ -282,6 +276,15 @@ var async = require('async'), } } }, + function(next) { + var meta = require('./meta'); + winston.info('Enabling default theme: Lavender'); + + meta.themes.set({ + type: 'local', + id: 'nodebb-theme-lavender' + }, next); + }, function (next) { // Check if an administrator needs to be created var Groups = require('./groups');