chore(deps): update dependency eslint-config-airbnb-base to v13 (#6599)

* chore(deps): update dependency eslint-config-airbnb-base to v13

* chore: #6599, linting 😬
v1.18.x
renovate[bot] 6 years ago committed by Julian Lam
parent eb0a322d7f
commit 64b9dabff8

@ -40,6 +40,7 @@
"avoidEscape": true,
"allowTemplateLiterals": true
}],
"no-else-return": [ "error", { "allowElseIf": true } ],
// ES6
"prefer-rest-params": "off",

@ -89,4 +89,3 @@ if (nconf.get('setup') || nconf.get('install')) {
} else {
require('./src/start').start();
}

@ -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",

@ -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);
}

@ -62,22 +62,22 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
graphData.rooms = data;
var html = '<div class="text-center pull-left">' +
'<span class="formatted-number">' + data.onlineRegisteredCount + '</span>' +
'<div class="stat">[[admin/general/dashboard:active-users.users]]</div>' +
'</div>' +
'<div class="text-center pull-left">' +
'<span class="formatted-number">' + data.onlineGuestCount + '</span>' +
'<div class="stat">[[admin/general/dashboard:active-users.guests]]</div>' +
'</div>' +
'<div class="text-center pull-left">' +
'<span class="formatted-number">' + (data.onlineRegisteredCount + data.onlineGuestCount) + '</span>' +
'<div class="stat">[[admin/general/dashboard:active-users.total]]</div>' +
'</div>' +
'<div class="text-center pull-left">' +
'<span class="formatted-number">' + data.socketCount + '</span>' +
'<div class="stat">[[admin/general/dashboard:active-users.connections]]</div>' +
'</div>';
var html = '<div class="text-center pull-left">'
+ '<span class="formatted-number">' + data.onlineRegisteredCount + '</span>'
+ '<div class="stat">[[admin/general/dashboard:active-users.users]]</div>'
+ '</div>'
+ '<div class="text-center pull-left">'
+ '<span class="formatted-number">' + data.onlineGuestCount + '</span>'
+ '<div class="stat">[[admin/general/dashboard:active-users.guests]]</div>'
+ '</div>'
+ '<div class="text-center pull-left">'
+ '<span class="formatted-number">' + (data.onlineRegisteredCount + data.onlineGuestCount) + '</span>'
+ '<div class="stat">[[admin/general/dashboard:active-users.total]]</div>'
+ '</div>'
+ '<div class="text-center pull-left">'
+ '<span class="formatted-number">' + data.socketCount + '</span>'
+ '<div class="stat">[[admin/general/dashboard:active-users.connections]]</div>'
+ '</div>';
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 : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.title + '</a>';
html += '<li>' +
'<div style="background-color: ' + topicColors[i] + ';"></div>' +
'<span>' + label + '</span>' +
'</li>';
html += '<li>'
+ '<div style="background-color: ' + topicColors[i] + ';"></div>'
+ '<span>' + label + '</span>'
+ '</li>';
});
legend.translateHtml(html);
}

@ -32,15 +32,15 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
'$1<span class="search-match">$2</span>$3'
);
return '<li role="presentation" class="result">' +
'<a role= "menuitem" href= "' + config.relative_path + '/' + namespace + '" >' +
title +
'<br>' + (!results ? '' :
('<small><code>' +
results +
'</small></code>')) +
'</a>' +
'</li>';
return '<li role="presentation" class="result">'
+ '<a role= "menuitem" href= "' + config.relative_path + '/' + namespace + '" >'
+ title
+ '<br>' + (!results ? ''
: ('<small><code>'
+ results
+ '</small></code>'))
+ '</a>'
+ '</li>';
}).join('');
return html;
}

@ -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) {

@ -58,10 +58,10 @@ define('forum/chats/search', ['components'], function (components) {
function displayUser(chatsListEl, userObj) {
function createUserImage() {
return (userObj.picture ?
'<img src="' + userObj.picture + '" title="' + userObj.username + '" />' :
'<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>') +
'<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
return (userObj.picture
? '<img src="' + userObj.picture + '" title="' + userObj.username + '" />'
: '<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>')
+ '<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
}
var chatEl = $('<li component="chat/search/user" />')

@ -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);

@ -66,4 +66,3 @@ define('categorySelector', ['benchpress', 'translator'], function (Benchpress, t
return categorySelector;
});

@ -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 += '<span class="category-children-item pull-left">' +
'<div class="icon pull-left" style="' + generateCategoryBackground(child) + '">' +
'<i class="fa fa-fw ' + child.icon + '"></i>' +
'</div>' +
'<a href="' + link + '"><small>' + child.name + '</small></a></span>';
html += '<span class="category-children-item pull-left">'
+ '<div class="icon pull-left" style="' + generateCategoryBackground(child) + '">'
+ '<i class="fa fa-fw ' + child.icon + '"></i>'
+ '</div>'
+ '<a href="' + link + '"><small>' + child.name + '</small></a></span>';
}
});
html = html ? ('<span class="category-children">' + html + '</span>') : html;

@ -117,4 +117,3 @@ define('iconSelect', ['benchpress'], function (Benchpress) {
return iconSelect;
});

@ -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;
}

@ -116,11 +116,11 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator
var taskbarEl = $('<li />')
.addClass(data.options.className)
.html('<a href="#">' +
(data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '') +
(data.options.image ? '<img src="' + data.options.image + '"/> ' : '') +
'<span component="taskbar/title">' + title + '</span>' +
'</a>')
.html('<a href="#">'
+ (data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '')
+ (data.options.image ? '<img src="' + data.options.image + '"/> ' : '')
+ '<span component="taskbar/title">' + title + '</span>'
+ '</a>')
.attr({
title: title,
'data-module': data.module,

@ -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;
}

@ -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

@ -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
);
},

@ -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) {

@ -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; },

@ -244,4 +244,3 @@ module.exports = function (Categories) {
], callback);
}
};

@ -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,
];
});

@ -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');

@ -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'
);
}

@ -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];
});

@ -133,4 +133,3 @@ profileController.get = function (req, res, callback) {
},
], callback);
};

@ -47,4 +47,3 @@ eventsController.get = function (req, res, next) {
},
], next);
};

@ -29,4 +29,3 @@ hooksController.get = function (req, res) {
res.render('admin/advanced/hooks', { hooks: hooks });
};

@ -24,4 +24,3 @@ languagesController.get = function (req, res, next) {
},
], next);
};

@ -46,4 +46,3 @@ themesController.get = function (req, res, next) {
},
], next);
};

@ -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 }]);
});
}

@ -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');
}
};

@ -184,4 +184,3 @@ modsController.postQueue = function (req, res, next) {
},
], next);
};

@ -54,4 +54,3 @@ function sendSitemap(method, res, callback) {
},
], callback);
}

@ -1,8 +1,8 @@
'use strict';
var meta = require('./meta');
var nconf = require('nconf');
var meta = require('./meta');
var coverPhoto = module.exports;

@ -1,7 +1,7 @@
'use strict';
var pubsub = require('../pubsub');
var LRU = require('lru-cache');
var pubsub = require('../pubsub');
var cache = LRU({
max: 40000,

@ -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) {

@ -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;
}

@ -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;

@ -273,4 +273,3 @@ module.exports = function (middleware) {
return title;
}
};

@ -61,4 +61,3 @@ module.exports = function (middleware) {
next();
};
};

@ -89,11 +89,11 @@ module.exports = function (middleware) {
}, next);
},
function (results, next) {
var str = results.header +
(res.locals.postHeader || '') +
results.content + '<script id="ajaxify-data"></script>' +
(res.locals.preFooter || '') +
results.footer;
var str = results.header
+ (res.locals.postHeader || '')
+ results.content + '<script id="ajaxify-data"></script>'
+ (res.locals.preFooter || '')
+ results.footer;
translate(str, req, res, next);
},

@ -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);
});
}

@ -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.'
));
}

@ -114,4 +114,3 @@ module.exports = function (Posts) {
], callback);
};
};

@ -70,4 +70,3 @@ module.exports = function (Posts) {
], callback);
};
};

@ -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));

@ -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', {

@ -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));
}

@ -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;

@ -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);
};

@ -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']);

@ -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);
}

@ -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;

@ -10,4 +10,3 @@ SocketRewards.save = function (socket, data, callback) {
SocketRewards.delete = function (socket, data, callback) {
rewardsAdmin.delete(data, callback);
};

@ -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]]'));
}

@ -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);
},

@ -259,4 +259,3 @@ Sockets.reqFromSocket = function (socket, payload, event) {
headers: headers,
};
};

@ -148,4 +148,3 @@ module.exports = function (SocketUser) {
], callback);
}
};

@ -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');

@ -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 };
});

@ -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 + ' ');
};

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
module.exports = {
name: 'Chat room hashes',

@ -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',

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
module.exports = {
name: 'Social: Post Sharing',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
module.exports = {
name: 'Giving upload privileges',

@ -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',

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
var batch = require('../../batch');
module.exports = {

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
var batch = require('../../batch');
module.exports = {

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
var batch = require('../../batch');
module.exports = {

@ -1,7 +1,7 @@
'use strict';
var db = require('../../database');
var nconf = require('nconf');
var db = require('../../database');
module.exports = {
name: 'Optimize PostgreSQL sessions',

@ -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');

@ -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');

@ -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',

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
module.exports = {
name: 'Category recent tids',

@ -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',

@ -1,8 +1,8 @@
'use strict';
var async = require('async');
var db = require('../../database');
var async = require('async');
module.exports = {
name: 'Favourites to Bookmarks',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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',

@ -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)',

@ -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',

@ -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);
},

@ -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]);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save