From 7cdcb83a98e2c625448d645dd7924b06e884aacb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 22 Jul 2014 13:53:09 -0400 Subject: [PATCH 1/8] fixed #1640 --- minifier.js | 2 +- src/meta/js.js | 51 +++++++++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/minifier.js b/minifier.js index a56578898d..5418659e16 100644 --- a/minifier.js +++ b/minifier.js @@ -24,7 +24,7 @@ Minifier.js.minify = function (scripts, minify, callback) { options.outSourceMap = 'nodebb.min.js.map'; options.mangle = false; options.compress = false; - options.prefix = __dirname.split(path.sep).length; + // options.prefix = __dirname.split(path.sep).length; } try { diff --git a/src/meta/js.js b/src/meta/js.js index b772f0ac05..4f0a94f187 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -5,6 +5,7 @@ var winston = require('winston'), path = require('path'), async = require('async'), _ = require('underscore'), + os = require('os'), plugins = require('../plugins'), emitter = require('../emitter'), @@ -74,30 +75,30 @@ module.exports = function(Meta) { Meta.js.prepare = function (callback) { plugins.fireHook('filter:scripts.get', Meta.js.scripts, function(err, scripts) { var jsPaths = scripts.map(function (jsPath) { - jsPath = path.normalize(jsPath); - - if (jsPath.substring(0, 7) === 'plugins') { - var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) { - if (jsPath.match(mappedPath)) { - return mappedPath; + jsPath = path.normalize(jsPath); + + if (jsPath.substring(0, 7) === 'plugins') { + var matches = _.map(plugins.staticDirs, function(realPath, mappedPath) { + if (jsPath.match(mappedPath)) { + return mappedPath; + } else { + return null; + } + }).filter(function(a) { return a; }); + + if (matches.length) { + var relPath = jsPath.slice(('plugins/' + matches[0]).length), + pluginId = matches[0].split(path.sep)[0]; + + return plugins.staticDirs[matches[0]] + relPath; } else { + winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + jsPath + '. Are you sure it is defined by a plugin?'); return null; } - }).filter(function(a) { return a; }); - - if (matches.length) { - var relPath = jsPath.slice(('plugins/' + matches[0]).length), - pluginId = matches[0].split(path.sep)[0]; - - return plugins.staticDirs[matches[0]] + relPath; } else { - winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + jsPath + '. Are you sure it is defined by a plugin?'); - return null; + return path.join(__dirname, '../..', '/public', jsPath); } - } else { - return path.join(__dirname, '../..', '/public', jsPath); - } - }); + }); Meta.js.scripts = jsPaths.filter(function(path) { return path !== null; @@ -123,6 +124,11 @@ module.exports = function(Meta) { next(err); }); }, function(err) { + // Translate into relative paths + Meta.js.scripts = Meta.js.scripts.map(function(script) { + return path.relative(path.resolve(__dirname, '../../'), script).replace(/\\/g, '/'); + }); + Meta.js.prepared = true; callback(err); }); @@ -163,4 +169,11 @@ module.exports = function(Meta) { Meta.js.minifierProc.kill('SIGTERM'); } }; + + // OS detection and handling + // if (os.platform() === 'win32') { + // Meta.js.scripts = Meta.js.scripts.map(function(script) { + // return script.replace(/\//g, '\\'); + // }); + // } }; \ No newline at end of file From ce8bec5edb5e42ca4ae988a34f124737f7a4351c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 23 Jul 2014 14:27:01 -0400 Subject: [PATCH 2/8] fixed mapping in web inspector --- minifier.js | 2 +- src/meta/js.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/minifier.js b/minifier.js index 5418659e16..3bd306a07c 100644 --- a/minifier.js +++ b/minifier.js @@ -24,7 +24,7 @@ Minifier.js.minify = function (scripts, minify, callback) { options.outSourceMap = 'nodebb.min.js.map'; options.mangle = false; options.compress = false; - // options.prefix = __dirname.split(path.sep).length; + options.prefix = 1; } try { diff --git a/src/meta/js.js b/src/meta/js.js index 4f0a94f187..3476f891da 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -126,7 +126,7 @@ module.exports = function(Meta) { }, function(err) { // Translate into relative paths Meta.js.scripts = Meta.js.scripts.map(function(script) { - return path.relative(path.resolve(__dirname, '../../'), script).replace(/\\/g, '/'); + return path.relative(path.resolve(__dirname, '../..'), script).replace(/\\/g, '/'); }); Meta.js.prepared = true; From e961e3c552bd4a7271603ff8cb584065d338997a Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 23 Jul 2014 14:33:31 -0400 Subject: [PATCH 3/8] reduced hightlight duration by 2 seconds --- public/src/modules/navigator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 4f8d57895b..9467971332 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -191,7 +191,7 @@ define('navigator', ['forum/topic/pagination'], function(pagination) { scrollTo.parent().find('.topic-item').addClass('highlight'); setTimeout(function() { scrollTo.parent().find('.topic-item').removeClass('highlight'); - }, 5000); + }, 3000); } } From dc30d94ff8344ec503fc4f377794fea5e6f19851 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 23 Jul 2014 15:41:47 -0400 Subject: [PATCH 4/8] info --- src/upgrade.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 0f908b1079..cb2ac37276 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -874,7 +874,7 @@ Upgrade.upgrade = function(callback) { winston.error('[2014/7/23] Error encountered while upgrading db dependencies'); return next(err); } - winston.error('[2014/7/23] Upgraded db dependencies'); + winston.info('[2014/7/23] Upgraded db dependencies'); Upgrade.update(thisSchemaDate, next); }); } else { From 7c20e3855609c4e72cd6d5c64e92e2c8fb8aff74 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 23 Jul 2014 15:43:56 -0400 Subject: [PATCH 5/8] updated vanilla and lavender to latest --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6fd50278c1..b185dc0af9 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "nodebb-plugin-markdown": "~0.5.0", "nodebb-plugin-mentions": "~0.5.0", "nodebb-plugin-soundpack-default": "~0.1.1", - "nodebb-theme-lavender": "~0.0.26", - "nodebb-theme-vanilla": "~0.0.21", + "nodebb-theme-lavender": "~0.0.74", + "nodebb-theme-vanilla": "~0.0.111", "nodebb-widget-essentials": "~0.1.0", "npm": "^1.4.6", "passport": "~0.2.0", From 7454fd53b9664a7122a4376b8f8f84405f9c349e Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 23 Jul 2014 16:49:32 -0400 Subject: [PATCH 6/8] possible fix for #1741 --- src/user/create.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/user/create.js b/src/user/create.js index 0f01cf22d0..e4c1227266 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -27,34 +27,38 @@ module.exports = function(User) { var password = userData.password; userData.password = null; - async.parallel([ - function(next) { + async.parallel({ + emailValid: function(next) { if (userData.email) { next(!utils.isEmailValid(userData.email) ? new Error('[[error:invalid-email]]') : null); } else { next(); } }, - function(next) { + userNameValid: function(next) { next((!utils.isUserNameValid(userData.username) || !userData.userslug) ? new Error('[[error:invalid-username]]') : null); }, - function(next) { + passwordValid: function(next) { if (password) { next(!utils.isPasswordValid(password) ? new Error('[[error:invalid-password]]') : null); } else { next(); } }, - function(next) { + renamedUsername: function(next) { meta.userOrGroupExists(userData.userslug, function(err, exists) { if (err) { return next(err); } if (exists) { + var newUsername = ''; async.forever(function(next) { - var newUsername = userData.username + (Math.floor(Math.random() * 255) + 1); + newUsername = userData.username + (Math.floor(Math.random() * 255) + 1); User.exists(newUsername, function(err, exists) { + if (err) { + return callback(err); + } if (!exists) { next(newUsername); } else { @@ -69,7 +73,7 @@ module.exports = function(User) { } }); }, - function(next) { + emailAvailable: function(next) { if (userData.email) { User.email.available(userData.email, function(err, available) { if (err) { @@ -81,28 +85,34 @@ module.exports = function(User) { next(); } }, - function(next) { + customFields: function(next) { plugins.fireHook('filter:user.custom_fields', userData, function(err, fields) { + if (err) { + return next(err); + } + delete fields.username; + delete fields.userslug; customFields = fields; next(err); }); }, - function(next) { + userData: function(next) { plugins.fireHook('filter:user.create', userData, function(err, filteredUserData){ next(err, utils.merge(userData, filteredUserData)); }); } - ], function(err, results) { + }, function(err, results) { if (err) { return callback(err); } - userData = results[results.length - 1]; - var userNameChanged = !!results[3]; + userData = results.userData; + var userNameChanged = !!results.renamedUsername; + // If a new username was picked... if (userNameChanged) { - userData.username = results[3]; - userData.userslug = utils.slugify(results[3]); + userData.username = results.renamedUsername; + userData.userslug = utils.slugify(results.renamedUsername); } db.incrObjectField('global', 'nextUid', function(err, uid) { From f38949d18501dfd728bc8963c2969efd8bb98194 Mon Sep 17 00:00:00 2001 From: Ken Van Dalsum Date: Wed, 23 Jul 2014 17:05:52 -0400 Subject: [PATCH 7/8] Fixed Typo --- docs/installing/os/windows8.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installing/os/windows8.rst b/docs/installing/os/windows8.rst index b9e54d90fb..ad67754233 100644 --- a/docs/installing/os/windows8.rst +++ b/docs/installing/os/windows8.rst @@ -9,7 +9,7 @@ First, install the following programs: * https://windows.github.com/ * http://nodejs.org/ * http://sourceforge.net/projects/redis/files/redis-2.6.10/ -* http://http://imagemagick.org/script/binary-releases.php#windows/ +* http://imagemagick.org/script/binary-releases.php#windows/ You may have to restart your computer. From 883cee31bcbbe29a1a410cc5af0fb1e6c179b2a9 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 23 Jul 2014 17:11:45 -0400 Subject: [PATCH 8/8] added support for showSiteTitle in ACP, closes #1519 --- src/controllers/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/api.js b/src/controllers/api.js index 0945ee2c55..f8522dadf1 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -15,6 +15,7 @@ apiController.getConfig = function(req, res, next) { config.relative_path = serverConfig.relative_path; config.version = pkg.version; config.siteTitle = meta.config.title || meta.config.browserTitle || 'NodeBB'; + config.showSiteTitle = meta.config.showSiteTitle === '1'; config.postDelay = meta.config.postDelay; config.minimumTitleLength = meta.config.minimumTitleLength; config.maximumTitleLength = meta.config.maximumTitleLength;