From da9da8190f1ca345b3da89b2ac5d4a9f1db403bb Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak
' +
+ ('' +
results +
'')) +
'' +
diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js
index e88eda06f0..5c16a45a95 100644
--- a/public/src/client/account/header.js
+++ b/public/src/client/account/header.js
@@ -73,7 +73,8 @@ define('forum/account/header', [
}
function setupCoverPhoto() {
- coverPhoto.init(components.get('account/cover'),
+ coverPhoto.init(
+ components.get('account/cover'),
function (imageData, position, callback) {
socket.emit('user.updateCover', {
uid: ajaxify.data.uid,
diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js
index 8f8caa2a1f..fc4a327021 100644
--- a/public/src/client/chats/messages.js
+++ b/public/src/client/chats/messages.js
@@ -96,9 +96,7 @@ define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpres
messages.scrollToBottom = function (containerEl) {
if (containerEl.length) {
- containerEl.scrollTop(
- containerEl[0].scrollHeight - containerEl.height()
- );
+ containerEl.scrollTop(containerEl[0].scrollHeight - containerEl.height());
}
};
diff --git a/public/src/client/chats/search.js b/public/src/client/chats/search.js
index f9504e78a4..1b76d665d8 100644
--- a/public/src/client/chats/search.js
+++ b/public/src/client/chats/search.js
@@ -63,8 +63,8 @@ define('forum/chats/search', ['components'], function (components) {
}
var chatEl = $('')
- .attr('data-uid', userObj.uid)
- .appendTo(chatsListEl);
+ .attr('data-uid', userObj.uid)
+ .appendTo(chatsListEl);
chatEl.append(createUserImage());
return chatEl;
diff --git a/public/src/client/groups/details.js b/public/src/client/groups/details.js
index e7225bb16c..65534df0aa 100644
--- a/public/src/client/groups/details.js
+++ b/public/src/client/groups/details.js
@@ -21,7 +21,8 @@ define('forum/groups/details', [
if (ajaxify.data.group.isOwner) {
Details.prepareSettings();
- coverPhoto.init(components.get('groups/cover'),
+ coverPhoto.init(
+ components.get('groups/cover'),
function (imageData, position, callback) {
socket.emit('groups.cover.update', {
groupName: groupName,
diff --git a/src/controllers/admin/uploads.js b/src/controllers/admin/uploads.js
index 42cade14cc..dc5bd7ce37 100644
--- a/src/controllers/admin/uploads.js
+++ b/src/controllers/admin/uploads.js
@@ -89,7 +89,7 @@ uploadsController.uploadLogo = function (req, res, next) {
uploadsController.uploadSound = function (req, res, next) {
var uploadedFile = req.files.files[0];
- var mimeType = mime.lookup(uploadedFile.name);
+ var mimeType = mime.getType(uploadedFile.name);
if (!/^audio\//.test(mimeType)) {
return next(Error('[[error:invalid-data]]'));
}
diff --git a/src/file.js b/src/file.js
index 31806d6252..ec86c624b1 100644
--- a/src/file.js
+++ b/src/file.js
@@ -45,7 +45,7 @@ file.saveFileToLocal = function (filename, folder, tempPath, callback) {
};
file.base64ToLocal = function (imageData, uploadPath, callback) {
- var buffer = new Buffer(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
+ var buffer = Buffer.from(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
uploadPath = path.join(nconf.get('upload_path'), uploadPath);
fs.writeFile(uploadPath, buffer, {
@@ -141,7 +141,7 @@ file.linkDirs = function linkDirs(sourceDir, destDir, callback) {
file.typeToExtension = function (type) {
var extension;
if (type) {
- extension = '.' + mime.extension(type);
+ extension = '.' + mime.getExtension(type);
}
return extension;
};
diff --git a/src/flags.js b/src/flags.js
index 9e3059d2a4..10635ee435 100644
--- a/src/flags.js
+++ b/src/flags.js
@@ -240,7 +240,7 @@ Flags.validate = function (payload, callback) {
}
var minimumReputation = utils.isNumber(meta.config['privileges:flag']) ? parseInt(meta.config['privileges:flag'], 10) : 1;
- // Check if reporter meets rep threshold (or can edit the target post, in which case threshold does not apply)
+ // Check if reporter meets rep threshold (or can edit the target post, in which case threshold does not apply)
if (!editable.flag && parseInt(data.reporter.reputation, 10) < minimumReputation) {
return callback(new Error('[[error:not-enough-reputation-to-flag]]'));
}
@@ -256,7 +256,7 @@ Flags.validate = function (payload, callback) {
}
var minimumReputation = utils.isNumber(meta.config['privileges:flag']) ? parseInt(meta.config['privileges:flag'], 10) : 1;
- // Check if reporter meets rep threshold (or can edit the target user, in which case threshold does not apply)
+ // Check if reporter meets rep threshold (or can edit the target user, in which case threshold does not apply)
if (!editable && parseInt(data.reporter.reputation, 10) < minimumReputation) {
return callback(new Error('[[error:not-enough-reputation-to-flag]]'));
}
diff --git a/src/groups/cover.js b/src/groups/cover.js
index 66cac228bf..289ee16302 100644
--- a/src/groups/cover.js
+++ b/src/groups/cover.js
@@ -26,7 +26,7 @@ module.exports = function (Groups) {
var tempPath = data.file ? data.file : '';
var url;
- var type = data.file ? mime.lookup(data.file) : 'image/png';
+ var type = data.file ? mime.getType(data.file) : 'image/png';
async.waterfall([
function (next) {
diff --git a/src/image.js b/src/image.js
index 4d3be47e6f..fc3ddd5e76 100644
--- a/src/image.js
+++ b/src/image.js
@@ -141,7 +141,7 @@ image.writeImageDataToTempFile = function (imageData, callback) {
var filepath = path.join(os.tmpdir(), filename + extension);
- var buffer = new Buffer(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
+ var buffer = Buffer.from(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
fs.writeFile(filepath, buffer, {
encoding: 'base64',
diff --git a/src/meta/minifier.js b/src/meta/minifier.js
index a3e40d195a..3b26f99ec5 100644
--- a/src/meta/minifier.js
+++ b/src/meta/minifier.js
@@ -282,9 +282,9 @@ function buildCSS(data, callback) {
processImportFrom: ['local'],
}),
] : [autoprefixer]).process(lessOutput.css).then(function (result) {
- callback(null, { code: result.css });
+ process.nextTick(callback, null, { code: result.css });
}, function (err) {
- callback(err);
+ process.nextTick(callback, err);
});
});
}
diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js
index ba52cd5f40..63e3cfaec1 100644
--- a/src/plugins/hooks.js
+++ b/src/plugins/hooks.js
@@ -39,8 +39,7 @@ module.exports = function (Plugins) {
(Plugins.deprecatedHooks[data.hook] ?
'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' :
'there is no alternative.'
- )
- );
+ ));
} else {
// handle hook's startsWith, i.e. action:homepage.get
var parts = data.hook.split(':');
@@ -61,7 +60,7 @@ module.exports = function (Plugins) {
if (memo && memo[prop]) {
return memo[prop];
}
- // Couldn't find method by path, aborting
+ // Couldn't find method by path, aborting
return null;
}, Plugins.libraries[data.id]);
diff --git a/src/topics/thumb.js b/src/topics/thumb.js
index 92963f70df..cfd13f3fb8 100644
--- a/src/topics/thumb.js
+++ b/src/topics/thumb.js
@@ -35,7 +35,7 @@ module.exports = function (Topics) {
var extension = path.extname(data.thumb);
if (!extension) {
- extension = '.' + mime.extension(type);
+ extension = '.' + mime.getExtension(type);
}
filename = Date.now() + '-topic-thumb' + extension;
pathToUpload = path.join(nconf.get('upload_path'), 'files', filename);
diff --git a/src/user/picture.js b/src/user/picture.js
index 817073163b..820d4b12ce 100644
--- a/src/user/picture.js
+++ b/src/user/picture.js
@@ -28,7 +28,7 @@ module.exports = function (User) {
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
var size = res.headers['content-length'];
var type = res.headers['content-type'];
- var extension = mime.extension(type);
+ var extension = mime.getExtension(type);
if (['png', 'jpeg', 'jpg', 'gif'].indexOf(extension) === -1) {
return callback(new Error('[[error:invalid-image-extension]]'));
diff --git a/test/build.js b/test/build.js
index 1287165a17..1c346ad621 100644
--- a/test/build.js
+++ b/test/build.js
@@ -114,7 +114,7 @@ describe('minifier', function () {
it('.css.bundle() should minify styles', function (done) {
minifier.css.bundle(styles, paths, true, false, function (err, bundle) {
assert.ifError(err);
- assert.strictEqual(bundle.code, '.help{margin:10px;display:block}.yellow{background:#ff0}.help .blue{background:#00f}');
+ assert.strictEqual(bundle.code, '.help{margin:10px}.yellow{background:#ff0}.help{display:block}.help .blue{background:#00f}');
done();
});
});
diff --git a/test/search-admin.js b/test/search-admin.js
index f885b2bbf9..3c2620dfc1 100644
--- a/test/search-admin.js
+++ b/test/search-admin.js
@@ -46,20 +46,20 @@ 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,24 +67,20 @@ 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(); }); }); diff --git a/test/socket.io.js b/test/socket.io.js index 76f7ae6a72..eb7489ef8a 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -72,7 +72,8 @@ describe('socket.io', function () { helpers.connectSocketIO(res, function (err, _io) { io = _io; assert.ifError(err); - done(err); + + done(); }); }); }); diff --git a/test/topics.js b/test/topics.js index 0592b9d030..f8c1ee5d16 100644 --- a/test/topics.js +++ b/test/topics.js @@ -654,8 +654,8 @@ describe('Topic\'s', function () { function (next) { topicPids = replies.map(function (reply) { return reply.pid; }); socketTopics.bookmark({ uid: topic.userId }, { tid: newTopic.tid, index: originalBookmark }, next); - }], - done); + }, + ], done); }); it('should fail with invalid data', function (done) { @@ -711,7 +711,8 @@ describe('Topic\'s', function () { 'Fork test, no bookmark update', topicPids.slice(1, 3), newTopic.tid, - next); + next + ); }, function (forkedTopicData, next) { topics.getUserBookmark(newTopic.tid, topic.userId, next);