Fix test, misc

v1.18.x
Peter Jaszkowiak 8 years ago
parent 3e562ceb83
commit ee9d7584e4

@ -125,10 +125,10 @@ define('admin/manage/categories', ['vendor/jquery/serializeObject/jquery.ba-seri
} }
function itemDragDidEnd(e) { function itemDragDidEnd(e) {
var isCategoryUpdate = (newCategoryId !== -1); var isCategoryUpdate = parseInt(newCategoryId, 10) !== -1;
// Update needed? // Update needed?
if ((e.newIndex != null && e.oldIndex !== e.newIndex) || isCategoryUpdate) { if ((e.newIndex != null && parseInt(e.oldIndex, 10) !== parseInt(e.newIndex, 10)) || isCategoryUpdate) {
var parentCategory = isCategoryUpdate ? sortables[newCategoryId] : sortables[e.from.dataset.cid]; var parentCategory = isCategoryUpdate ? sortables[newCategoryId] : sortables[e.from.dataset.cid];
var modified = {}; var modified = {};
var i = 0; var i = 0;

@ -416,7 +416,9 @@ Controllers.handleURIErrors = function (err, req, res, next) {
} }
}; };
Controllers.handleErrors = function (err, req, res) { // this needs to have four arguments or express treats it as `(req, res, next)`
// don't remove `next`!
Controllers.handleErrors = function (err, req, res, next) { // eslint-disable-line no-unused-vars
switch (err.code) { switch (err.code) {
case 'EBADCSRFTOKEN': case 'EBADCSRFTOKEN':
winston.error(req.path + '\n', err.message); winston.error(req.path + '\n', err.message);

@ -794,7 +794,7 @@ describe('Groups', function () {
helpers.uploadFile(nconf.get('url') + '/api/groups/uploadpicture', logoPath, { params: JSON.stringify({ groupName: 'Test' }) }, jar, csrf_token, function (err, res, body) { helpers.uploadFile(nconf.get('url') + '/api/groups/uploadpicture', logoPath, { params: JSON.stringify({ groupName: 'Test' }) }, jar, csrf_token, function (err, res, body) {
assert.ifError(err); assert.ifError(err);
assert.equal(res.statusCode, 500); assert.equal(res.statusCode, 500);
assert(/\[\[error:no-privileges\]\]/.test(body)); assert.equal(body.error, '[[error:no-privileges]]');
done(); done();
}); });
}); });

Loading…
Cancel
Save