mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-07 18:11:10 +02:00
use includes instead of indexOf
use _.uniq instead of filter&indexOf
This commit is contained in:
@@ -55,7 +55,7 @@ pluginsController.get = function (req, res, next) {
|
||||
return !plugin.installed;
|
||||
}),
|
||||
incompatible: payload.all.filter(function (plugin) {
|
||||
return compatiblePkgNames.indexOf(plugin.name) === -1;
|
||||
return !compatiblePkgNames.includes(plugin.name);
|
||||
}),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ function renderEmail(req, res, next) {
|
||||
res.render('admin/settings/email', {
|
||||
emails: results.emails,
|
||||
sendable: results.emails.filter(function (email) {
|
||||
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
||||
return !email.path.includes('_plaintext') && !email.path.includes('partials');
|
||||
}),
|
||||
services: results.services,
|
||||
});
|
||||
|
||||
@@ -261,7 +261,7 @@ function upload(name, req, res, next) {
|
||||
}
|
||||
|
||||
function validateUpload(req, res, next, uploadedFile, allowedTypes) {
|
||||
if (allowedTypes.indexOf(uploadedFile.type) === -1) {
|
||||
if (!allowedTypes.includes(uploadedFile.type)) {
|
||||
file.delete(uploadedFile.path);
|
||||
res.json({ error: '[[error:invalid-image-type, ' + allowedTypes.join(', ') + ']]' });
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user