mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 03:27:01 +02:00
chore(deps): update dependency eslint-config-airbnb-base to v13 (#6599)
* chore(deps): update dependency eslint-config-airbnb-base to v13 * chore: #6599, linting 😬
This commit is contained in:
committed by
Julian Lam
parent
eb0a322d7f
commit
64b9dabff8
@@ -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]);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -63,4 +63,3 @@ module.exports = function (User) {
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user