diff --git a/.eslintrc b/.eslintrc index 9414543335..117ea3db0a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -40,6 +40,7 @@ "avoidEscape": true, "allowTemplateLiterals": true }], + "no-else-return": [ "error", { "allowElseIf": true } ], // ES6 "prefer-rest-params": "off", diff --git a/app.js b/app.js index 99ff814e62..ca72e23e16 100644 --- a/app.js +++ b/app.js @@ -89,4 +89,3 @@ if (nconf.get('setup') || nconf.get('install')) { } else { require('./src/start').start(); } - diff --git a/install/package.json b/install/package.json index 9216d1fcf6..123e966a00 100644 --- a/install/package.json +++ b/install/package.json @@ -127,7 +127,7 @@ "devDependencies": { "coveralls": "3.0.2", "eslint": "5.8.0", - "eslint-config-airbnb-base": "12.1.0", + "eslint-config-airbnb-base": "13.1.0", "eslint-plugin-import": "2.14.0", "grunt": "1.0.3", "grunt-contrib-watch": "1.1.0", diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js index ee2432fa5c..db02c2e551 100644 --- a/public/src/admin/admin.js +++ b/public/src/admin/admin.js @@ -99,9 +99,9 @@ } else { var matches = url.match(/admin\/(.+?)\/(.+?)$/); mainTitle = '[[admin/menu:' + matches[1] + '/' + matches[2] + ']]'; - pageTitle = '[[admin/menu:section-' + - (matches[1] === 'development' ? 'advanced' : matches[1]) + - ']]' + (matches[2] ? (' > ' + mainTitle) : ''); + pageTitle = '[[admin/menu:section-' + + (matches[1] === 'development' ? 'advanced' : matches[1]) + + ']]' + (matches[2] ? (' > ' + mainTitle) : ''); if (matches[2] === 'settings') { mainTitle = translator.compile('admin/menu:settings.page-title', mainTitle); } diff --git a/public/src/admin/general/dashboard.js b/public/src/admin/general/dashboard.js index 486eee17ba..9e7f805f23 100644 --- a/public/src/admin/general/dashboard.js +++ b/public/src/admin/general/dashboard.js @@ -62,22 +62,22 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress' graphData.rooms = data; - var html = '
' + - '' + data.onlineRegisteredCount + '' + - '
[[admin/general/dashboard:active-users.users]]
' + - '
' + - '
' + - '' + data.onlineGuestCount + '' + - '
[[admin/general/dashboard:active-users.guests]]
' + - '
' + - '
' + - '' + (data.onlineRegisteredCount + data.onlineGuestCount) + '' + - '
[[admin/general/dashboard:active-users.total]]
' + - '
' + - '
' + - '' + data.socketCount + '' + - '
[[admin/general/dashboard:active-users.connections]]
' + - '
'; + var html = '
' + + '' + data.onlineRegisteredCount + '' + + '
[[admin/general/dashboard:active-users.users]]
' + + '
' + + '
' + + '' + data.onlineGuestCount + '' + + '
[[admin/general/dashboard:active-users.guests]]
' + + '
' + + '
' + + '' + (data.onlineRegisteredCount + data.onlineGuestCount) + '' + + '
[[admin/general/dashboard:active-users.total]]
' + + '
' + + '
' + + '' + data.socketCount + '' + + '
[[admin/general/dashboard:active-users.connections]]
' + + '
'; updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount); updatePresenceGraph(data.users); @@ -506,10 +506,10 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress' topics.forEach(function (topic, i) { var label = topic.count === '0' ? topic.title : ' ' + topic.title + ''; - html += '
  • ' + - '
    ' + - '' + label + '' + - '
  • '; + html += '
  • ' + + '
    ' + + '' + label + '' + + '
  • '; }); legend.translateHtml(html); } diff --git a/public/src/admin/modules/search.js b/public/src/admin/modules/search.js index 2a5798c18a..9f4de7cf01 100644 --- a/public/src/admin/modules/search.js +++ b/public/src/admin/modules/search.js @@ -32,15 +32,15 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) { '$1$2$3' ); - return ''; + return ''; }).join(''); return html; } diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index b6a8ce9b1c..9ab0b181ca 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -70,8 +70,8 @@ define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpres var lastSpeaker = parseInt(chatContentEl.find('.chat-message').last().attr('data-uid'), 10); var lasttimestamp = parseInt(chatContentEl.find('.chat-message').last().attr('data-timestamp'), 10); if (!Array.isArray(data)) { - data.newSet = lastSpeaker !== parseInt(data.fromuid, 10) || - parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3); + data.newSet = lastSpeaker !== parseInt(data.fromuid, 10) + || parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3); } messages.parseMessage(data, function (html) { diff --git a/public/src/client/chats/search.js b/public/src/client/chats/search.js index e40551ed05..61a0fb8673 100644 --- a/public/src/client/chats/search.js +++ b/public/src/client/chats/search.js @@ -58,10 +58,10 @@ define('forum/chats/search', ['components'], function (components) { function displayUser(chatsListEl, userObj) { function createUserImage() { - return (userObj.picture ? - '' : - '
    ' + userObj['icon:text'] + '
    ') + - ' ' + userObj.username; + return (userObj.picture + ? '' + : '
    ' + userObj['icon:text'] + '
    ') + + ' ' + userObj.username; } var chatEl = $('
  • ') diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 9c4d698b01..3016e91b4d 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -71,8 +71,8 @@ define('forum/topic/posts', [ ajaxify.data.pagination.pageCount = Math.max(1, Math.ceil(posts[0].topic.postcount / config.postsPerPage)); var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1; - var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1) || - (ajaxify.data.pagination.currentPage === 1 && direction === -1); + var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1) + || (ajaxify.data.pagination.currentPage === 1 && direction === -1); if (isPostVisible) { createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost); diff --git a/public/src/modules/categorySelector.js b/public/src/modules/categorySelector.js index b9b8c9e3a4..c4d6d3313c 100644 --- a/public/src/modules/categorySelector.js +++ b/public/src/modules/categorySelector.js @@ -66,4 +66,3 @@ define('categorySelector', ['benchpress', 'translator'], function (Benchpress, t return categorySelector; }); - diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js index 9e0eb2088c..45235e3321 100644 --- a/public/src/modules/helpers.js +++ b/public/src/modules/helpers.js @@ -42,10 +42,10 @@ var properties = item.properties; var loggedIn = data.config ? data.config.loggedIn : false; if (properties) { - if ((properties.loggedIn && !loggedIn) || - (properties.guestOnly && loggedIn) || - (properties.globalMod && !data.isGlobalMod && !data.isAdmin) || - (properties.adminOnly && !data.isAdmin)) { + if ((properties.loggedIn && !loggedIn) + || (properties.guestOnly && loggedIn) + || (properties.globalMod && !data.isGlobalMod && !data.isAdmin) + || (properties.adminOnly && !data.isAdmin)) { return false; } } @@ -125,11 +125,11 @@ category.children.forEach(function (child) { if (child && !child.isSection) { var link = child.link ? child.link : (relative_path + '/category/' + child.slug); - html += '' + - '
    ' + - '' + - '
    ' + - '' + child.name + '
    '; + html += '' + + '
    ' + + '' + + '
    ' + + '' + child.name + '
    '; } }); html = html ? ('' + html + '') : html; diff --git a/public/src/modules/iconSelect.js b/public/src/modules/iconSelect.js index 2b9fcb4865..4285140d4d 100644 --- a/public/src/modules/iconSelect.js +++ b/public/src/modules/iconSelect.js @@ -117,4 +117,3 @@ define('iconSelect', ['benchpress'], function (Benchpress) { return iconSelect; }); - diff --git a/public/src/modules/scrollStop.js b/public/src/modules/scrollStop.js index 0e07641cc3..fe410ac7e4 100644 --- a/public/src/modules/scrollStop.js +++ b/public/src/modules/scrollStop.js @@ -19,8 +19,8 @@ define('scrollStop', function () { var elementHeight = Math.round(this.getBoundingClientRect().height); if ( - (e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up - (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down + (e.originalEvent.deltaY < 0 && scrollTop === 0) // scroll up + || (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down ) { return false; } diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js index 5a1c0d886f..b577efbe0a 100644 --- a/public/src/modules/taskbar.js +++ b/public/src/modules/taskbar.js @@ -116,11 +116,11 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator var taskbarEl = $('
  • ') .addClass(data.options.className) - .html('' + - (data.options.icon ? ' ' : '') + - (data.options.image ? ' ' : '') + - '' + title + '' + - '') + .html('' + + (data.options.icon ? ' ' : '') + + (data.options.image ? ' ' : '') + + '' + title + '' + + '') .attr({ title: title, 'data-module': data.module, diff --git a/public/src/modules/topicList.js b/public/src/modules/topicList.js index 48a6ad3b67..689d3c573c 100644 --- a/public/src/modules/topicList.js +++ b/public/src/modules/topicList.js @@ -65,9 +65,9 @@ define('topicList', ['forum/infinitescroll', 'handleBack', 'topicSelect'], funct }; function onNewTopic(data) { - if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1) || - (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched') || - (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) { + if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1) + || (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched') + || (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) { return; } @@ -82,11 +82,11 @@ define('topicList', ['forum/infinitescroll', 'handleBack', 'topicSelect'], funct } var post = data.posts[0]; - if ((!post || !post.topic) || - (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10)) || - (ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1) || - (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new') || - (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))) { + if ((!post || !post.topic) + || (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10)) + || (ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1) + || (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new') + || (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))) { return; } diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index 65fd44df52..fb1110e947 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -181,8 +181,8 @@ cursor += 1; // a space or comma was found before the name // this isn't a translation string, so back out - } else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) && - invalidTextRegex.test(char0)) { + } else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) + && invalidTextRegex.test(char0)) { cursor += 1; lastBreak -= 2; // no longer in a token diff --git a/public/src/utils.js b/public/src/utils.js index 5e75be82a8..90ab4a8118 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -625,10 +625,10 @@ var rect = el.getBoundingClientRect(); return ( - rect.top >= 0 && - rect.left >= 0 && - rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */ - rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */ + rect.top >= 0 + && rect.left >= 0 + && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */ + && rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */ ); }, @@ -731,10 +731,10 @@ }, isInternalURI: function (targetLocation, referenceLocation, relative_path) { - return targetLocation.host === '' || // Relative paths are always internal links - ( - targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol && // Otherwise need to check if protocol and host match - (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check + return targetLocation.host === '' // Relative paths are always internal links + || ( + targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol // Otherwise need to check if protocol and host match + && (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check ); }, diff --git a/src/admin/search.js b/src/admin/search.js index 6f9792138e..a0ab3895c8 100644 --- a/src/admin/search.js +++ b/src/admin/search.js @@ -18,10 +18,10 @@ function filterDirectories(directories) { // exclude partials // only include subpaths // exclude category.tpl, group.tpl, category-analytics.tpl - return !dir.endsWith('.js') && - !dir.includes('/partials/') && - /\/.*\//.test(dir) && - !/manage\/(category|group|category-analytics)$/.test(dir); + return !dir.endsWith('.js') + && !dir.includes('/partials/') + && /\/.*\//.test(dir) + && !/manage\/(category|group|category-analytics)$/.test(dir); }); } @@ -138,10 +138,10 @@ function initDict(language, callback) { title = '[[admin/menu:general/dashboard]]'; } else { title = title.match(/admin\/(.+?)\/(.+?)$/); - title = '[[admin/menu:section-' + - (title[1] === 'development' ? 'advanced' : title[1]) + - ']]' + (title[2] ? (' > [[admin/menu:' + - title[1] + '/' + title[2] + ']]') : ''); + title = '[[admin/menu:section-' + + (title[1] === 'development' ? 'advanced' : title[1]) + + ']]' + (title[2] ? (' > [[admin/menu:' + + title[1] + '/' + title[2] + ']]') : ''); } translator.translate(title).then(function (title) { diff --git a/src/analytics.js b/src/analytics.js index e25c948bf9..ef7656f674 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -5,6 +5,7 @@ var async = require('async'); var winston = require('winston'); var nconf = require('nconf'); var crypto = require('crypto'); +var LRU = require('lru-cache'); var db = require('./database'); var plugins = require('./plugins'); @@ -25,7 +26,6 @@ var uniquevisitors = 0; * the cache could be exhausted continuously if there are more than 500 concurrently * active users */ -var LRU = require('lru-cache'); var ipCache = LRU({ max: 500, length: function () { return 1; }, diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js index ab0d7b475a..e4262ab7cb 100644 --- a/src/categories/recentreplies.js +++ b/src/categories/recentreplies.js @@ -244,4 +244,3 @@ module.exports = function (Categories) { ], callback); } }; - diff --git a/src/cli/colors.js b/src/cli/colors.js index bb2648e1d5..df0f0961cd 100644 --- a/src/cli/colors.js +++ b/src/cli/colors.js @@ -65,9 +65,9 @@ Command.prototype.usage = function () { return humanReadableArgName(arg); }); - var usage = '[options]'[optionColor] + - (this.commands.length ? ' [command]' : '')[subCommandColor] + - (this._args.length ? ' ' + args.join(' ') : '')[argColor]; + var usage = '[options]'[optionColor] + + (this.commands.length ? ' [command]' : '')[subCommandColor] + + (this._args.length ? ' ' + args.join(' ') : '')[argColor]; return usage; }; @@ -90,10 +90,10 @@ Command.prototype.commandHelp = function () { }).join(' '); return [ - cmd._name[subCommandColor] + - (cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor] + - (cmd.options.length ? ' [options]' : '')[subOptionColor] + - ' ' + args[subArgColor], + cmd._name[subCommandColor] + + (cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor] + + (cmd.options.length ? ' [options]' : '')[subOptionColor] + + ' ' + args[subArgColor], cmd._description, ]; }); diff --git a/src/cli/index.js b/src/cli/index.js index 2387185437..7b7cbf8cf2 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -65,7 +65,9 @@ try { } require('colors'); +// eslint-disable-next-line var nconf = require('nconf'); +// eslint-disable-next-line var program = require('commander'); var pkg = require('../../package.json'); diff --git a/src/cli/manage.js b/src/cli/manage.js index 9d360494ec..dd908c7377 100644 --- a/src/cli/manage.js +++ b/src/cli/manage.js @@ -27,10 +27,10 @@ function buildTargets() { return ' ' + _.padEnd('"' + tuple[0] + '"', length + 2).magenta + ' | ' + tuple[1]; }).join('\n'); console.log( - '\n\n Build targets:\n' + - ('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green + - '\n ------------------------------------------------------\n'.blue + - output + '\n' + '\n\n Build targets:\n' + + ('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green + + '\n ------------------------------------------------------\n'.blue + + output + '\n' ); } diff --git a/src/cli/upgrade.js b/src/cli/upgrade.js index 618183111e..046e8539df 100644 --- a/src/cli/upgrade.js +++ b/src/cli/upgrade.js @@ -88,8 +88,8 @@ function runUpgrade(upgrades, options) { if (upgrades === true) { var tasks = Object.keys(steps); - if (options.package || options.install || - options.plugins || options.schema || options.build) { + if (options.package || options.install + || options.plugins || options.schema || options.build) { tasks = tasks.filter(function (key) { return options[key]; }); diff --git a/src/controllers/accounts/profile.js b/src/controllers/accounts/profile.js index b6b5c54284..a75513331a 100644 --- a/src/controllers/accounts/profile.js +++ b/src/controllers/accounts/profile.js @@ -133,4 +133,3 @@ profileController.get = function (req, res, callback) { }, ], callback); }; - diff --git a/src/controllers/admin/events.js b/src/controllers/admin/events.js index 88a2848f37..73038f2894 100644 --- a/src/controllers/admin/events.js +++ b/src/controllers/admin/events.js @@ -47,4 +47,3 @@ eventsController.get = function (req, res, next) { }, ], next); }; - diff --git a/src/controllers/admin/hooks.js b/src/controllers/admin/hooks.js index 8c88c21a08..40e84e5fc6 100644 --- a/src/controllers/admin/hooks.js +++ b/src/controllers/admin/hooks.js @@ -29,4 +29,3 @@ hooksController.get = function (req, res) { res.render('admin/advanced/hooks', { hooks: hooks }); }; - diff --git a/src/controllers/admin/languages.js b/src/controllers/admin/languages.js index fe3849465a..6276b4c08a 100644 --- a/src/controllers/admin/languages.js +++ b/src/controllers/admin/languages.js @@ -24,4 +24,3 @@ languagesController.get = function (req, res, next) { }, ], next); }; - diff --git a/src/controllers/admin/themes.js b/src/controllers/admin/themes.js index 719cb8ecff..99a1e12c98 100644 --- a/src/controllers/admin/themes.js +++ b/src/controllers/admin/themes.js @@ -46,4 +46,3 @@ themesController.get = function (req, res, next) { }, ], next); }; - diff --git a/src/controllers/admin/uploads.js b/src/controllers/admin/uploads.js index 8e6ad7cc45..d0af465347 100644 --- a/src/controllers/admin/uploads.js +++ b/src/controllers/admin/uploads.js @@ -317,4 +317,3 @@ function uploadImage(filename, folder, uploadedFile, req, res, next) { res.json([{ name: uploadedFile.name, url: image.url.startsWith('http') ? image.url : nconf.get('relative_path') + image.url }]); }); } - diff --git a/src/controllers/index.js b/src/controllers/index.js index ed94cd4713..eddc1132d5 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -249,10 +249,10 @@ Controllers.robots = function (req, res) { if (meta.config['robots:txt']) { res.send(meta.config['robots:txt']); } else { - res.send('User-agent: *\n' + - 'Disallow: ' + nconf.get('relative_path') + '/admin/\n' + - 'Disallow: ' + nconf.get('relative_path') + '/reset/\n' + - 'Sitemap: ' + nconf.get('url') + '/sitemap.xml'); + res.send('User-agent: *\n' + + 'Disallow: ' + nconf.get('relative_path') + '/admin/\n' + + 'Disallow: ' + nconf.get('relative_path') + '/reset/\n' + + 'Sitemap: ' + nconf.get('url') + '/sitemap.xml'); } }; diff --git a/src/controllers/mods.js b/src/controllers/mods.js index bfdac30f7a..7dc2b32b76 100644 --- a/src/controllers/mods.js +++ b/src/controllers/mods.js @@ -184,4 +184,3 @@ modsController.postQueue = function (req, res, next) { }, ], next); }; - diff --git a/src/controllers/sitemap.js b/src/controllers/sitemap.js index 224a6dbcc3..69d2df50c6 100644 --- a/src/controllers/sitemap.js +++ b/src/controllers/sitemap.js @@ -54,4 +54,3 @@ function sendSitemap(method, res, callback) { }, ], callback); } - diff --git a/src/coverPhoto.js b/src/coverPhoto.js index 59fc897ac4..ec1b3f7be9 100644 --- a/src/coverPhoto.js +++ b/src/coverPhoto.js @@ -1,8 +1,8 @@ 'use strict'; -var meta = require('./meta'); var nconf = require('nconf'); +var meta = require('./meta'); var coverPhoto = module.exports; diff --git a/src/groups/cache.js b/src/groups/cache.js index 7036d0b60c..627327ff94 100644 --- a/src/groups/cache.js +++ b/src/groups/cache.js @@ -1,7 +1,7 @@ 'use strict'; -var pubsub = require('../pubsub'); var LRU = require('lru-cache'); +var pubsub = require('../pubsub'); var cache = LRU({ max: 40000, diff --git a/src/groups/create.js b/src/groups/create.js index a5b60e68b5..20b4f0bee8 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -77,9 +77,9 @@ module.exports = function (Groups) { }; function isSystemGroup(data) { - return data.system === true || parseInt(data.system, 10) === 1 || - data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators' || - Groups.isPrivilegeGroup(data.name); + return data.system === true || parseInt(data.system, 10) === 1 + || data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators' + || Groups.isPrivilegeGroup(data.name); } function validateGroupName(name, callback) { diff --git a/src/messaging/data.js b/src/messaging/data.js index 84ac7e8c19..1d689ced7d 100644 --- a/src/messaging/data.js +++ b/src/messaging/data.js @@ -134,8 +134,8 @@ module.exports = function (Messaging) { Messaging.getMessageFields(mid, ['fromuid', 'timestamp'], next); }, function (fields, next) { - if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff) || - (messages[0].fromuid !== fields.fromuid)) { + if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff) + || (messages[0].fromuid !== fields.fromuid)) { // If it's been 5 minutes, this is a new set of messages messages[0].newSet = true; } diff --git a/src/meta/blacklist.js b/src/meta/blacklist.js index eced8ea413..bcf3c57816 100644 --- a/src/meta/blacklist.js +++ b/src/meta/blacklist.js @@ -80,9 +80,9 @@ Blacklist.test = function (clientIp, callback) { } if ( - !Blacklist._rules.ipv4.includes(clientIp) && // not explicitly specified in ipv4 list - !Blacklist._rules.ipv6.includes(clientIp) && // not explicitly specified in ipv6 list - !Blacklist._rules.cidr.some(function (subnet) { + !Blacklist._rules.ipv4.includes(clientIp) // not explicitly specified in ipv4 list + && !Blacklist._rules.ipv6.includes(clientIp) // not explicitly specified in ipv6 list + && !Blacklist._rules.cidr.some(function (subnet) { var cidr = ipaddr.parseCIDR(subnet); if (addr.kind() !== cidr[0].kind()) { return false; diff --git a/src/middleware/header.js b/src/middleware/header.js index f8a84ffed5..d29592a499 100644 --- a/src/middleware/header.js +++ b/src/middleware/header.js @@ -273,4 +273,3 @@ module.exports = function (middleware) { return title; } }; - diff --git a/src/middleware/headers.js b/src/middleware/headers.js index f700ac4017..3eafc203d9 100644 --- a/src/middleware/headers.js +++ b/src/middleware/headers.js @@ -61,4 +61,3 @@ module.exports = function (middleware) { next(); }; }; - diff --git a/src/middleware/render.js b/src/middleware/render.js index 4d6476dc34..34e58fafa2 100644 --- a/src/middleware/render.js +++ b/src/middleware/render.js @@ -89,11 +89,11 @@ module.exports = function (middleware) { }, next); }, function (results, next) { - var str = results.header + - (res.locals.postHeader || '') + - results.content + '' + - (res.locals.preFooter || '') + - results.footer; + var str = results.header + + (res.locals.postHeader || '') + + results.content + '' + + (res.locals.preFooter || '') + + results.footer; translate(str, req, res, next); }, diff --git a/src/plugins/data.js b/src/plugins/data.js index 0dd7fa3a67..31cd2c402c 100644 --- a/src/plugins/data.js +++ b/src/plugins/data.js @@ -106,16 +106,16 @@ function getStaticDirectories(pluginData, callback) { async.each(dirs, function (route, next) { if (!validMappedPath.test(route)) { - winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: ' + - route + '. Path must adhere to: ' + validMappedPath.toString()); + winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: ' + + route + '. Path must adhere to: ' + validMappedPath.toString()); return next(); } var dirPath = path.join(pluginData.path, pluginData.staticDirs[route]); fs.stat(dirPath, function (err, stats) { if (err && err.code === 'ENOENT') { - winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' + - route + ' => ' + dirPath + '\' not found.'); + winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' + + route + ' => ' + dirPath + '\' not found.'); return next(); } if (err) { @@ -123,8 +123,8 @@ function getStaticDirectories(pluginData, callback) { } if (!stats.isDirectory()) { - winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' + - route + ' => ' + dirPath + '\' is not a directory.'); + winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' + + route + ' => ' + dirPath + '\' is not a directory.'); return next(); } @@ -135,8 +135,8 @@ function getStaticDirectories(pluginData, callback) { if (err) { return callback(err); } - winston.verbose('[plugins] found ' + Object.keys(staticDirs).length + - ' static directories for ' + pluginData.id); + winston.verbose('[plugins] found ' + Object.keys(staticDirs).length + + ' static directories for ' + pluginData.id); callback(null, staticDirs); }); } diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index d5f268a80e..6a5a161d33 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -34,10 +34,10 @@ module.exports = function (Plugins) { var method; if (Object.keys(Plugins.deprecatedHooks).includes(data.hook)) { - winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, ' + - (Plugins.deprecatedHooks[data.hook] ? - 'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' : - 'there is no alternative.' + winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, ' + + (Plugins.deprecatedHooks[data.hook] + ? 'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' + : 'there is no alternative.' )); } diff --git a/src/posts/create.js b/src/posts/create.js index 3074b298fe..3aa0753e7f 100644 --- a/src/posts/create.js +++ b/src/posts/create.js @@ -114,4 +114,3 @@ module.exports = function (Posts) { ], callback); }; }; - diff --git a/src/posts/tools.js b/src/posts/tools.js index 6d8164aec9..cd59129d4c 100644 --- a/src/posts/tools.js +++ b/src/posts/tools.js @@ -70,4 +70,3 @@ module.exports = function (Posts) { ], callback); }; }; - diff --git a/src/privileges/categories.js b/src/privileges/categories.js index 860a56d8c2..71e800d158 100644 --- a/src/privileges/categories.js +++ b/src/privileges/categories.js @@ -141,8 +141,8 @@ module.exports = function (privileges) { }, function (results, next) { cids = cids.filter(function (cid, index) { - return !results.categories[index].disabled && - (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); + return !results.categories[index].disabled + && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); }); next(null, cids.filter(Boolean)); diff --git a/src/privileges/posts.js b/src/privileges/posts.js index a28a12378b..df19b3397f 100644 --- a/src/privileges/posts.js +++ b/src/privileges/posts.js @@ -115,15 +115,15 @@ module.exports = function (privileges) { var isModOf = {}; cids = cids.filter(function (cid, index) { isModOf[cid] = results.isModerators[index]; - return !results.categories[index].disabled && - (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); + return !results.categories[index].disabled + && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); }); const cidsSet = new Set(cids); pids = postData.filter(function (post) { - return post.topic && cidsSet.has(post.topic.cid) && - ((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]); + return post.topic && cidsSet.has(post.topic.cid) + && ((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]); }).map(post => post.pid); plugins.fireHook('filter:privileges.posts.filter', { diff --git a/src/privileges/topics.js b/src/privileges/topics.js index 7a1e2f4195..4df8a158c6 100644 --- a/src/privileges/topics.js +++ b/src/privileges/topics.js @@ -92,15 +92,15 @@ module.exports = function (privileges) { var isModOf = {}; cids = cids.filter(function (cid, index) { isModOf[cid] = results.isModerators[index]; - return !results.categories[index].disabled && - (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); + return !results.categories[index].disabled + && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]); }); const cidsSet = new Set(cids); tids = topicsData.filter(function (topic) { - return cidsSet.has(topic.cid) && - (!topic.deleted || results.isAdmin || isModOf[topic.cid]); + return cidsSet.has(topic.cid) + && (!topic.deleted || results.isAdmin || isModOf[topic.cid]); }).map(topic => topic.tid); plugins.fireHook('filter:privileges.topics.filter', { @@ -144,8 +144,8 @@ module.exports = function (privileges) { }, function (results, next) { uids = uids.filter(function (uid, index) { - return !results.disabled && - ((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]); + return !results.disabled + && ((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]); }); next(null, uids); @@ -193,9 +193,9 @@ module.exports = function (privileges) { var preventTopicDeleteAfterReplies = meta.config.preventTopicDeleteAfterReplies; if (preventTopicDeleteAfterReplies && (topicData.postcount - 1) >= preventTopicDeleteAfterReplies) { - var langKey = preventTopicDeleteAfterReplies > 1 ? - '[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]' : - '[[error:cant-delete-topic-has-reply]]'; + var langKey = preventTopicDeleteAfterReplies > 1 + ? '[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]' + : '[[error:cant-delete-topic-has-reply]]'; return next(new Error(langKey)); } diff --git a/src/rewards/index.js b/src/rewards/index.js index 0fc1b0edf3..ca75df9ca1 100644 --- a/src/rewards/index.js +++ b/src/rewards/index.js @@ -1,9 +1,9 @@ 'use strict'; +var async = require('async'); var db = require('../database'); var plugins = require('../plugins'); -var async = require('async'); var rewards = module.exports; diff --git a/src/routes/api.js b/src/routes/api.js index 012f0b26f0..3bcfca342e 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -39,4 +39,3 @@ module.exports = function (app, middleware, controllers) { router.post('/user/:userslug/uploadcover', middlewares.concat([middleware.authenticate, middleware.checkGlobalPrivacySettings, middleware.checkAccountPermissions]), controllers.accounts.edit.uploadCoverPicture); router.post('/groups/uploadpicture', middlewares.concat([middleware.authenticate]), controllers.groups.uploadCover); }; - diff --git a/src/routes/index.js b/src/routes/index.js index cf7fb86002..d82c6b2b09 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -171,8 +171,8 @@ module.exports = function (app, middleware, callback) { // DEPRECATED (v1.12.0) app.use(relativePath + '/assets/stylesheet.css', function (req, res) { if (!warned.has(req.path)) { - winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. ' + - 'Use `/assets/client.css` to access this file'); + winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. ' + + 'Use `/assets/client.css` to access this file'); warned.add(req.path); } res.redirect(relativePath + '/assets/client.css?' + meta.config['cache-buster']); diff --git a/src/sitemap.js b/src/sitemap.js index 663f7da08e..38f29a3d9c 100644 --- a/src/sitemap.js +++ b/src/sitemap.js @@ -42,8 +42,8 @@ sitemap.render = function (callback) { sitemap.getPages = function (callback) { if ( - sitemap.maps.pages && - Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10) + sitemap.maps.pages + && Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10) ) { return sitemap.maps.pages.toXML(callback); } @@ -82,8 +82,8 @@ sitemap.getPages = function (callback) { sitemap.getCategories = function (callback) { if ( - sitemap.maps.categories && - Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10) + sitemap.maps.categories + && Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10) ) { return sitemap.maps.categories.toXML(callback); } @@ -124,8 +124,8 @@ sitemap.getTopicPage = function (page, callback) { var max = min + numTopics; if ( - sitemap.maps.topics[page - 1] && - Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10) + sitemap.maps.topics[page - 1] + && Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10) ) { return sitemap.maps.topics[page - 1].toXML(callback); } diff --git a/src/social.js b/src/social.js index c1315e54e6..43b8250522 100644 --- a/src/social.js +++ b/src/social.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var plugins = require('./plugins'); var db = require('./database'); -var async = require('async'); var social = module.exports; diff --git a/src/socket.io/admin/rewards.js b/src/socket.io/admin/rewards.js index 8b845a33c1..b5fac9c670 100644 --- a/src/socket.io/admin/rewards.js +++ b/src/socket.io/admin/rewards.js @@ -10,4 +10,3 @@ SocketRewards.save = function (socket, data, callback) { SocketRewards.delete = function (socket, data, callback) { rewardsAdmin.delete(data, callback); }; - diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js index 2834fd3c5f..ebc80d66d5 100644 --- a/src/socket.io/groups.js +++ b/src/socket.io/groups.js @@ -249,10 +249,10 @@ SocketGroups.create = function (socket, data, callback) { }; SocketGroups.delete = isOwner(function (socket, data, callback) { - if (data.groupName === 'administrators' || - data.groupName === 'registered-users' || - data.groupName === 'guests' || - data.groupName === 'Global Moderators') { + if (data.groupName === 'administrators' + || data.groupName === 'registered-users' + || data.groupName === 'guests' + || data.groupName === 'Global Moderators') { return callback(new Error('[[error:not-allowed]]')); } diff --git a/src/socket.io/helpers.js b/src/socket.io/helpers.js index 256389cac6..76e128e044 100644 --- a/src/socket.io/helpers.js +++ b/src/socket.io/helpers.js @@ -70,8 +70,8 @@ function filterTidCidIgnorers(uids, tid, cid, callback) { }, function (results, next) { uids = uids.filter(function (uid, index) { - return results.topicFollowed[index] || - (!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]); + return results.topicFollowed[index] + || (!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]); }); next(null, uids); }, diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 046f64e91d..1919fb1ad8 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -259,4 +259,3 @@ Sockets.reqFromSocket = function (socket, payload, event) { headers: headers, }; }; - diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index b53398791f..1084a82625 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -148,4 +148,3 @@ module.exports = function (SocketUser) { ], callback); } }; - diff --git a/src/topics/tags.js b/src/topics/tags.js index 377757919d..4ad2b2981d 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -4,9 +4,9 @@ var async = require('async'); var validator = require('validator'); +var _ = require('lodash'); var db = require('../database'); var meta = require('../meta'); -var _ = require('lodash'); var plugins = require('../plugins'); var utils = require('../utils'); var batch = require('../batch'); diff --git a/src/topics/unread.js b/src/topics/unread.js index 3b7eb0590a..1965d5f733 100644 --- a/src/topics/unread.js +++ b/src/topics/unread.js @@ -464,9 +464,9 @@ module.exports = function (Topics) { function (results, next) { var cutoff = Topics.unreadCutoff(); var result = tids.map(function (tid, index) { - var read = !results.tids_unread[index] && - (results.topicScores[index] < cutoff || - !!(results.userScores[index] && results.userScores[index] >= results.topicScores[index])); + var read = !results.tids_unread[index] + && (results.topicScores[index] < cutoff + || !!(results.userScores[index] && results.userScores[index] >= results.topicScores[index])); return { tid: tid, read: read, index: index }; }); diff --git a/src/upgrade.js b/src/upgrade.js index 1b698480da..35c8ca6273 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -217,4 +217,3 @@ Upgrade.incrementProgress = function (value) { readline.cursorTo(process.stdout, 0); process.stdout.write(' [' + (filled ? new Array(filled).join('#') : '') + new Array(unfilled).join(' ') + '] (' + this.current + '/' + (this.total || '??') + ') ' + percentage + ' '); }; - diff --git a/src/upgrades/1.0.0/chat_room_hashes.js b/src/upgrades/1.0.0/chat_room_hashes.js index ae52be31f7..27257c7c16 100644 --- a/src/upgrades/1.0.0/chat_room_hashes.js +++ b/src/upgrades/1.0.0/chat_room_hashes.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Chat room hashes', diff --git a/src/upgrades/1.0.0/chat_upgrade.js b/src/upgrades/1.0.0/chat_upgrade.js index d5a971d4b4..10bb024ae9 100644 --- a/src/upgrades/1.0.0/chat_upgrade.js +++ b/src/upgrades/1.0.0/chat_upgrade.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Upgrading chats', diff --git a/src/upgrades/1.0.0/social_post_sharing.js b/src/upgrades/1.0.0/social_post_sharing.js index 3477da86bb..99dbdbdb4d 100644 --- a/src/upgrades/1.0.0/social_post_sharing.js +++ b/src/upgrades/1.0.0/social_post_sharing.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Social: Post Sharing', diff --git a/src/upgrades/1.0.0/theme_to_active_plugins.js b/src/upgrades/1.0.0/theme_to_active_plugins.js index 07b95f45aa..08fee6ad2b 100644 --- a/src/upgrades/1.0.0/theme_to_active_plugins.js +++ b/src/upgrades/1.0.0/theme_to_active_plugins.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Adding theme to active plugins sorted set', diff --git a/src/upgrades/1.0.0/user_best_posts.js b/src/upgrades/1.0.0/user_best_posts.js index 986e88efa7..1980f9c473 100644 --- a/src/upgrades/1.0.0/user_best_posts.js +++ b/src/upgrades/1.0.0/user_best_posts.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Creating user best post sorted sets', diff --git a/src/upgrades/1.0.0/users_notvalidated.js b/src/upgrades/1.0.0/users_notvalidated.js index a69deb90df..78523736f0 100644 --- a/src/upgrades/1.0.0/users_notvalidated.js +++ b/src/upgrades/1.0.0/users_notvalidated.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Creating users:notvalidated', diff --git a/src/upgrades/1.1.0/assign_topic_read_privilege.js b/src/upgrades/1.1.0/assign_topic_read_privilege.js index 93d06485e6..564fb9dae9 100644 --- a/src/upgrades/1.1.0/assign_topic_read_privilege.js +++ b/src/upgrades/1.1.0/assign_topic_read_privilege.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Giving topics:read privs to any group that was previously allowed to Find & Access Category', diff --git a/src/upgrades/1.1.0/dismiss_flags_from_deleted_topics.js b/src/upgrades/1.1.0/dismiss_flags_from_deleted_topics.js index 37e2fce239..07becbd858 100644 --- a/src/upgrades/1.1.0/dismiss_flags_from_deleted_topics.js +++ b/src/upgrades/1.1.0/dismiss_flags_from_deleted_topics.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Dismiss flags from deleted topics', diff --git a/src/upgrades/1.1.0/group_title_update.js b/src/upgrades/1.1.0/group_title_update.js index 7b8847f276..1734050866 100644 --- a/src/upgrades/1.1.0/group_title_update.js +++ b/src/upgrades/1.1.0/group_title_update.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Group title from settings to user profile', diff --git a/src/upgrades/1.1.0/separate_upvote_downvote.js b/src/upgrades/1.1.0/separate_upvote_downvote.js index dbfb5aee09..0c8d9f9fdf 100644 --- a/src/upgrades/1.1.0/separate_upvote_downvote.js +++ b/src/upgrades/1.1.0/separate_upvote_downvote.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Store upvotes/downvotes separately', diff --git a/src/upgrades/1.1.0/user_post_count_per_tid.js b/src/upgrades/1.1.0/user_post_count_per_tid.js index f275e7a9a4..64faa475ec 100644 --- a/src/upgrades/1.1.0/user_post_count_per_tid.js +++ b/src/upgrades/1.1.0/user_post_count_per_tid.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Users post count per tid', diff --git a/src/upgrades/1.1.1/remove_negative_best_posts.js b/src/upgrades/1.1.1/remove_negative_best_posts.js index cadf1a397f..d9889a97c1 100644 --- a/src/upgrades/1.1.1/remove_negative_best_posts.js +++ b/src/upgrades/1.1.1/remove_negative_best_posts.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Removing best posts with negative scores', diff --git a/src/upgrades/1.1.1/upload_privileges.js b/src/upgrades/1.1.1/upload_privileges.js index 217e6e19fe..454f538a8a 100644 --- a/src/upgrades/1.1.1/upload_privileges.js +++ b/src/upgrades/1.1.1/upload_privileges.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Giving upload privileges', diff --git a/src/upgrades/1.10.0/hash_recent_ip_addresses.js b/src/upgrades/1.10.0/hash_recent_ip_addresses.js index a2d7d1a99e..6d04171074 100644 --- a/src/upgrades/1.10.0/hash_recent_ip_addresses.js +++ b/src/upgrades/1.10.0/hash_recent_ip_addresses.js @@ -1,11 +1,11 @@ 'use strict'; -var db = require('../../database'); -var batch = require('../../batch'); var async = require('async'); var crypto = require('crypto'); var nconf = require('nconf'); +var batch = require('../../batch'); +var db = require('../../database'); module.exports = { name: 'Hash all IP addresses stored in Recent IPs zset', diff --git a/src/upgrades/1.10.2/event_filters.js b/src/upgrades/1.10.2/event_filters.js index 4f2e87485e..167ae152b3 100644 --- a/src/upgrades/1.10.2/event_filters.js +++ b/src/upgrades/1.10.2/event_filters.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); var batch = require('../../batch'); module.exports = { diff --git a/src/upgrades/1.10.2/fix_category_post_zsets.js b/src/upgrades/1.10.2/fix_category_post_zsets.js index 216026f753..4c3d4f800a 100644 --- a/src/upgrades/1.10.2/fix_category_post_zsets.js +++ b/src/upgrades/1.10.2/fix_category_post_zsets.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); var batch = require('../../batch'); module.exports = { diff --git a/src/upgrades/1.10.2/fix_category_topic_zsets.js b/src/upgrades/1.10.2/fix_category_topic_zsets.js index 11b7b1a9da..c9d67231ff 100644 --- a/src/upgrades/1.10.2/fix_category_topic_zsets.js +++ b/src/upgrades/1.10.2/fix_category_topic_zsets.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); var batch = require('../../batch'); module.exports = { diff --git a/src/upgrades/1.10.2/postgres_sessions.js b/src/upgrades/1.10.2/postgres_sessions.js index b77a3f9b92..850ae5d1b9 100644 --- a/src/upgrades/1.10.2/postgres_sessions.js +++ b/src/upgrades/1.10.2/postgres_sessions.js @@ -1,7 +1,7 @@ 'use strict'; -var db = require('../../database'); var nconf = require('nconf'); +var db = require('../../database'); module.exports = { name: 'Optimize PostgreSQL sessions', diff --git a/src/upgrades/1.10.2/upgrade_bans_to_hashes.js b/src/upgrades/1.10.2/upgrade_bans_to_hashes.js index bce9b7ce43..c096728331 100644 --- a/src/upgrades/1.10.2/upgrade_bans_to_hashes.js +++ b/src/upgrades/1.10.2/upgrade_bans_to_hashes.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); var batch = require('../../batch'); // var user = require('../../user'); diff --git a/src/upgrades/1.10.2/username_email_history.js b/src/upgrades/1.10.2/username_email_history.js index 1aea342b4b..2407c72ce2 100644 --- a/src/upgrades/1.10.2/username_email_history.js +++ b/src/upgrades/1.10.2/username_email_history.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); var batch = require('../../batch'); var user = require('../../user'); diff --git a/src/upgrades/1.11.0/resize_image_width.js b/src/upgrades/1.11.0/resize_image_width.js index 60d98f9991..36881eeef3 100644 --- a/src/upgrades/1.11.0/resize_image_width.js +++ b/src/upgrades/1.11.0/resize_image_width.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Rename maximumImageWidth to resizeImageWidth', diff --git a/src/upgrades/1.2.0/category_recent_tids.js b/src/upgrades/1.2.0/category_recent_tids.js index 3d8d1cdf9c..16f34d2452 100644 --- a/src/upgrades/1.2.0/category_recent_tids.js +++ b/src/upgrades/1.2.0/category_recent_tids.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Category recent tids', diff --git a/src/upgrades/1.2.0/edit_delete_deletetopic_privileges.js b/src/upgrades/1.2.0/edit_delete_deletetopic_privileges.js index 40f8eda0ce..a4910881bd 100644 --- a/src/upgrades/1.2.0/edit_delete_deletetopic_privileges.js +++ b/src/upgrades/1.2.0/edit_delete_deletetopic_privileges.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Granting edit/delete/delete topic on existing categories', diff --git a/src/upgrades/1.3.0/favourites_to_bookmarks.js b/src/upgrades/1.3.0/favourites_to_bookmarks.js index b1037c860f..a609969be3 100644 --- a/src/upgrades/1.3.0/favourites_to_bookmarks.js +++ b/src/upgrades/1.3.0/favourites_to_bookmarks.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Favourites to Bookmarks', diff --git a/src/upgrades/1.3.0/sorted_sets_for_post_replies.js b/src/upgrades/1.3.0/sorted_sets_for_post_replies.js index e5a5506591..401daf4a4a 100644 --- a/src/upgrades/1.3.0/sorted_sets_for_post_replies.js +++ b/src/upgrades/1.3.0/sorted_sets_for_post_replies.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Sorted sets for post replies', diff --git a/src/upgrades/1.4.0/global_and_user_language_keys.js b/src/upgrades/1.4.0/global_and_user_language_keys.js index 3428ad5678..dac4a216b4 100644 --- a/src/upgrades/1.4.0/global_and_user_language_keys.js +++ b/src/upgrades/1.4.0/global_and_user_language_keys.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Update global and user language keys', diff --git a/src/upgrades/1.4.0/sorted_set_for_pinned_topics.js b/src/upgrades/1.4.0/sorted_set_for_pinned_topics.js index c461c8df05..273b08b413 100644 --- a/src/upgrades/1.4.0/sorted_set_for_pinned_topics.js +++ b/src/upgrades/1.4.0/sorted_set_for_pinned_topics.js @@ -1,9 +1,9 @@ 'use strict'; -var db = require('../../database'); var async = require('async'); var winston = require('winston'); +var db = require('../../database'); module.exports = { name: 'Sorted set for pinned topics', diff --git a/src/upgrades/1.4.4/config_urls_update.js b/src/upgrades/1.4.4/config_urls_update.js index 02689ceecb..95b0cc61c5 100644 --- a/src/upgrades/1.4.4/config_urls_update.js +++ b/src/upgrades/1.4.4/config_urls_update.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Upgrading config urls to use assets route', diff --git a/src/upgrades/1.4.4/sound_settings.js b/src/upgrades/1.4.4/sound_settings.js index 7ea381bcca..fb86f7bbd7 100644 --- a/src/upgrades/1.4.4/sound_settings.js +++ b/src/upgrades/1.4.4/sound_settings.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Update global and user sound settings', diff --git a/src/upgrades/1.5.0/flags_refactor.js b/src/upgrades/1.5.0/flags_refactor.js index f80714ee50..cdc1d54d55 100644 --- a/src/upgrades/1.5.0/flags_refactor.js +++ b/src/upgrades/1.5.0/flags_refactor.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Migrating flags to new schema', diff --git a/src/upgrades/1.5.0/moderation_history_refactor.js b/src/upgrades/1.5.0/moderation_history_refactor.js index 59e10367d8..5eadfe46ea 100644 --- a/src/upgrades/1.5.0/moderation_history_refactor.js +++ b/src/upgrades/1.5.0/moderation_history_refactor.js @@ -1,9 +1,9 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); var batch = require('../../batch'); -var async = require('async'); module.exports = { name: 'Update moderation notes to zset', diff --git a/src/upgrades/1.5.0/post_votes_zset.js b/src/upgrades/1.5.0/post_votes_zset.js index 4b5795a4b8..dca19bc730 100644 --- a/src/upgrades/1.5.0/post_votes_zset.js +++ b/src/upgrades/1.5.0/post_votes_zset.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'New sorted set posts:votes', diff --git a/src/upgrades/1.5.0/remove_relative_uploaded_profile_cover.js b/src/upgrades/1.5.0/remove_relative_uploaded_profile_cover.js index fc8eb542f6..0d228efaf8 100644 --- a/src/upgrades/1.5.0/remove_relative_uploaded_profile_cover.js +++ b/src/upgrades/1.5.0/remove_relative_uploaded_profile_cover.js @@ -1,9 +1,9 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); var batch = require('../../batch'); -var async = require('async'); module.exports = { name: 'Remove relative_path from uploaded profile cover urls', diff --git a/src/upgrades/1.6.0/clear-stale-digest-template.js b/src/upgrades/1.6.0/clear-stale-digest-template.js index 8b7adeed4b..76370443bb 100644 --- a/src/upgrades/1.6.0/clear-stale-digest-template.js +++ b/src/upgrades/1.6.0/clear-stale-digest-template.js @@ -1,9 +1,9 @@ 'use strict'; -var meta = require('../../meta'); var async = require('async'); var crypto = require('crypto'); +var meta = require('../../meta'); module.exports = { name: 'Clearing stale digest templates that were accidentally saved as custom', diff --git a/src/upgrades/1.6.0/generate-email-logo.js b/src/upgrades/1.6.0/generate-email-logo.js index 5832fb9739..7b94ecb717 100644 --- a/src/upgrades/1.6.0/generate-email-logo.js +++ b/src/upgrades/1.6.0/generate-email-logo.js @@ -1,12 +1,12 @@ 'use strict'; -var image = require('../../image'); -var meta = require('../../meta'); var async = require('async'); var path = require('path'); var nconf = require('nconf'); var fs = require('fs'); +var meta = require('../../meta'); +var image = require('../../image'); module.exports = { name: 'Generate email logo for use in email header', diff --git a/src/upgrades/1.7.6/update_min_pass_strength.js b/src/upgrades/1.7.6/update_min_pass_strength.js index e12ed5d067..238d152843 100644 --- a/src/upgrades/1.7.6/update_min_pass_strength.js +++ b/src/upgrades/1.7.6/update_min_pass_strength.js @@ -1,8 +1,8 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); -var async = require('async'); module.exports = { name: 'Revising minimum password strength to 1 (from 0)', diff --git a/src/upgrades/1.8.1/diffs_zset_to_listhash.js b/src/upgrades/1.8.1/diffs_zset_to_listhash.js index d5e065c698..a457514bef 100644 --- a/src/upgrades/1.8.1/diffs_zset_to_listhash.js +++ b/src/upgrades/1.8.1/diffs_zset_to_listhash.js @@ -1,9 +1,9 @@ 'use strict'; +var async = require('async'); var db = require('../../database'); const batch = require('../../batch'); -var async = require('async'); module.exports = { name: 'Reformatting post diffs to be stored in lists and hash instead of single zset', diff --git a/src/user/approval.js b/src/user/approval.js index db78ea65e7..f4cd14fc3b 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -244,11 +244,11 @@ module.exports = function (User) { function (next) { request({ method: 'get', - url: 'http://api.stopforumspam.org/api' + - '?ip=' + encodeURIComponent(user.ip) + - '&email=' + encodeURIComponent(user.email) + - '&username=' + encodeURIComponent(user.username) + - '&f=json', + url: 'http://api.stopforumspam.org/api' + + '?ip=' + encodeURIComponent(user.ip) + + '&email=' + encodeURIComponent(user.email) + + '&username=' + encodeURIComponent(user.username) + + '&f=json', json: true, }, next); }, diff --git a/src/user/auth.js b/src/user/auth.js index 63e45e8334..96bfa57a64 100644 --- a/src/user/auth.js +++ b/src/user/auth.js @@ -109,9 +109,9 @@ module.exports = function (User) { var expired; sessions = sessions.filter(function (sessionObj, idx) { - expired = !sessionObj || !sessionObj.hasOwnProperty('passport') || - !sessionObj.passport.hasOwnProperty('user') || - parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10); + expired = !sessionObj || !sessionObj.hasOwnProperty('passport') + || !sessionObj.passport.hasOwnProperty('user') + || parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10); if (expired) { expiredSids.push(_sids[idx]); diff --git a/src/user/create.js b/src/user/create.js index fecdf7a1ae..9ab23a33dc 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -1,14 +1,14 @@ 'use strict'; var async = require('async'); +var validator = require('validator'); +var zxcvbn = require('zxcvbn'); var db = require('../database'); var utils = require('../utils'); -var validator = require('validator'); var plugins = require('../plugins'); var groups = require('../groups'); var meta = require('../meta'); -var zxcvbn = require('zxcvbn'); module.exports = function (User) { User.create = function (data, callback) { diff --git a/src/user/jobs.js b/src/user/jobs.js index ccdadb146d..2127706e7d 100644 --- a/src/user/jobs.js +++ b/src/user/jobs.js @@ -63,4 +63,3 @@ module.exports = function (User) { } }; }; - diff --git a/src/webserver.js b/src/webserver.js index 4a094a7b43..286320ddd4 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -20,6 +20,7 @@ var favicon = require('serve-favicon'); var detector = require('spider-detector'); var helmet = require('helmet'); +var Benchpress = require('benchpressjs'); var db = require('./database'); var file = require('./file'); var emailer = require('./emailer'); @@ -30,7 +31,6 @@ var plugins = require('./plugins'); var flags = require('./flags'); var routes = require('./routes'); var auth = require('./routes/authentication'); -var Benchpress = require('benchpressjs'); var helpers = require('../public/src/modules/helpers'); @@ -353,4 +353,3 @@ module.exports.testSocket = function (socketPath, callback) { async.apply(fs.unlink, socketPath), // The socket was stale, kick it out of the way ], callback); }; - diff --git a/src/widgets/index.js b/src/widgets/index.js index d2440d20db..a4603117ec 100644 --- a/src/widgets/index.js +++ b/src/widgets/index.js @@ -39,10 +39,10 @@ widgets.render = function (uid, options, callback) { } async.map(widgetsByLocation[location], function (widget, next) { - if (!widget || !widget.data || - (!!widget.data['hide-registered'] && uid !== 0) || - (!!widget.data['hide-guests'] && uid === 0) || - (!!widget.data['hide-mobile'] && options.req.useragent.isMobile)) { + if (!widget || !widget.data + || (!!widget.data['hide-registered'] && uid !== 0) + || (!!widget.data['hide-guests'] && uid === 0) + || (!!widget.data['hide-mobile'] && options.req.useragent.isMobile)) { return next(); } diff --git a/test/authentication.js b/test/authentication.js index 83c4092e11..8df2ceda6c 100644 --- a/test/authentication.js +++ b/test/authentication.js @@ -518,4 +518,3 @@ describe('authentication', function () { ], done); }); }); - diff --git a/test/build.js b/test/build.js index 0b40b28aa4..460249608b 100644 --- a/test/build.js +++ b/test/build.js @@ -41,16 +41,16 @@ describe('minifier', function () { assert.strictEqual( fs.readFileSync(destPath).toString().replace(/\r\n/g, '\n'), - '(function (window, document) {' + - '\n\twindow.doStuff = function () {' + - '\n\t\tdocument.body.innerHTML = \'Stuff has been done\';' + - '\n\t};' + - '\n})(window, document);' + - '\n' + - '\n;function foo(name, age) {' + - '\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';' + - '\n}' + - '\n' + '(function (window, document) {' + + '\n\twindow.doStuff = function () {' + + '\n\t\tdocument.body.innerHTML = \'Stuff has been done\';' + + '\n\t};' + + '\n})(window, document);' + + '\n' + + '\n;function foo(name, age) {' + + '\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';' + + '\n}' + + '\n' ); done(); }); @@ -69,8 +69,8 @@ describe('minifier', function () { assert.strictEqual( fs.readFileSync(destPath).toString(), - '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}' + - '\n//# sourceMappingURL=minified.js.map' + '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}' + + '\n//# sourceMappingURL=minified.js.map' ); done(); }); @@ -87,8 +87,8 @@ describe('minifier', function () { assert.ifError(err); assert.strictEqual( buffer.toString(), - '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);' + - '\n//# sourceMappingURL=1.js.map' + '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);' + + '\n//# sourceMappingURL=1.js.map' ); done(); }); diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js index 917daf7fa6..6caae02821 100644 --- a/test/mocks/databasemock.js +++ b/test/mocks/databasemock.js @@ -14,9 +14,9 @@ var url = require('url'); global.env = process.env.TEST_ENV || 'production'; +var winston = require('winston'); var packageInfo = require('../../package'); -var winston = require('winston'); winston.add(new winston.transports.Console({ format: winston.format.combine( winston.format.splat(), @@ -45,47 +45,47 @@ var productionDbConfig = nconf.get(dbType); if (!testDbConfig) { const errorText = 'test_database is not defined'; winston.info( - '\n===========================================================\n' + - 'Please, add parameters for test database in config.json\n' + - 'For example (redis):\n' + - '"test_database": {\n' + - ' "host": "127.0.0.1",\n' + - ' "port": "6379",\n' + - ' "password": "",\n' + - ' "database": "1"\n' + - '}\n' + - ' or (mongo):\n' + - '"test_database": {\n' + - ' "host": "127.0.0.1",\n' + - ' "port": "27017",\n' + - ' "password": "",\n' + - ' "database": "1"\n' + - '}\n' + - ' or (mongo) in a replicaset\n' + - '"test_database": {\n' + - ' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n' + - ' "port": "27017,27018,27019",\n' + - ' "username": "",\n' + - ' "password": "",\n' + - ' "database": "nodebb_test"\n' + - '}\n' + - ' or (postgres):\n' + - '"test_database": {\n' + - ' "host": "127.0.0.1",\n' + - ' "port": "5432",\n' + - ' "username": "postgres",\n' + - ' "password": "",\n' + - ' "database": "nodebb_test"\n' + - '}\n' + - '===========================================================' + '\n===========================================================\n' + + 'Please, add parameters for test database in config.json\n' + + 'For example (redis):\n' + + '"test_database": {\n' + + ' "host": "127.0.0.1",\n' + + ' "port": "6379",\n' + + ' "password": "",\n' + + ' "database": "1"\n' + + '}\n' + + ' or (mongo):\n' + + '"test_database": {\n' + + ' "host": "127.0.0.1",\n' + + ' "port": "27017",\n' + + ' "password": "",\n' + + ' "database": "1"\n' + + '}\n' + + ' or (mongo) in a replicaset\n' + + '"test_database": {\n' + + ' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n' + + ' "port": "27017,27018,27019",\n' + + ' "username": "",\n' + + ' "password": "",\n' + + ' "database": "nodebb_test"\n' + + '}\n' + + ' or (postgres):\n' + + '"test_database": {\n' + + ' "host": "127.0.0.1",\n' + + ' "port": "5432",\n' + + ' "username": "postgres",\n' + + ' "password": "",\n' + + ' "database": "nodebb_test"\n' + + '}\n' + + '===========================================================' ); winston.error(errorText); throw new Error(errorText); } -if (testDbConfig.database === productionDbConfig.database && - testDbConfig.host === productionDbConfig.host && - testDbConfig.port === productionDbConfig.port) { +if (testDbConfig.database === productionDbConfig.database + && testDbConfig.host === productionDbConfig.host + && testDbConfig.port === productionDbConfig.port) { const errorText = 'test_database has the same config as production db'; winston.error(errorText); throw new Error(errorText); diff --git a/test/plugins.js b/test/plugins.js index d10642a2e0..a717f395c3 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -203,4 +203,3 @@ describe('Plugins', function () { }); }); }); - diff --git a/test/search-admin.js b/test/search-admin.js index 3c2620dfc1..5e3594d4b8 100644 --- a/test/search-admin.js +++ b/test/search-admin.js @@ -46,19 +46,19 @@ describe('admin search', function () { describe('sanitize', function () { it('should strip out scripts', function (done) { assert.equal( - search.sanitize('Pellentesque tristique senectus' + - ' habitant morbi'), - 'Pellentesque tristique senectus' + - ' habitant morbi' + search.sanitize('Pellentesque tristique senectus' + + ' habitant morbi'), + 'Pellentesque tristique senectus' + + ' habitant morbi' ); done(); }); it('should remove all tags', function (done) { assert.equal( - search.sanitize('

    Pellentesque habitant morbi tristique senectus' + - 'Aenean vitae est.Mauris eleifend leo.

    '), - 'Pellentesque habitant morbi tristique senectus' + - 'Aenean vitae est.Mauris eleifend leo.' + search.sanitize('

    Pellentesque habitant morbi tristique senectus' + + 'Aenean vitae est.Mauris eleifend leo.

    '), + 'Pellentesque habitant morbi tristique senectus' + + 'Aenean vitae est.Mauris eleifend leo.' ); done(); }); @@ -67,19 +67,19 @@ describe('admin search', function () { describe('simplify', function () { it('should remove all mustaches', function (done) { assert.equal( - search.simplify('Pellentesque tristique {{senectus}}habitant morbi' + - 'liquam tincidunt {mauris.eu}risus'), - 'Pellentesque tristique habitant morbi' + - 'liquam tincidunt risus' + search.simplify('Pellentesque tristique {{senectus}}habitant morbi' + + 'liquam tincidunt {mauris.eu}risus'), + 'Pellentesque tristique habitant morbi' + + 'liquam tincidunt risus' ); done(); }); it('should collapse all whitespace', function (done) { assert.equal( - search.simplify('Pellentesque tristique habitant morbi' + - ' \n\n liquam tincidunt mauris eu risus.'), - 'Pellentesque tristique habitant morbi' + - '\nliquam tincidunt mauris eu risus.' + search.simplify('Pellentesque tristique habitant morbi' + + ' \n\n liquam tincidunt mauris eu risus.'), + 'Pellentesque tristique habitant morbi' + + '\nliquam tincidunt mauris eu risus.' ); done(); });