From 2878b5ae005d24b31fc13c8adac3fffc5ddcec45 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Sat, 18 Jul 2015 02:26:15 +0200 Subject: [PATCH] Update lodash and cheerio - update lodash to 3.1.0 - cheerio update uses new css-select, css-what packages (others were deprecated) refs #5578 --- core/server/api/mail.js | 6 +++--- core/test/unit/config_spec.js | 5 +++-- core/test/utils/index.js | 4 +++- package.json | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/server/api/mail.js b/core/server/api/mail.js index da49ddf04a..62a7d08ee4 100644 --- a/core/server/api/mail.js +++ b/core/server/api/mail.js @@ -1,6 +1,6 @@ // # Mail API // API for sending Mail -var _ = require('lodash'), +var _ = require('lodash').runInContext(), Promise = require('bluebird'), config = require('../config'), canThis = require('../permissions').canThis, @@ -99,12 +99,12 @@ mail = { } // insert user-specific data into the email - var htmlContent = _.template(fileContent, emailData), + var compiled = _.template(fileContent), + htmlContent = compiled(emailData), textContent; // generate a plain-text version of the same email textContent = htmlToText.fromString(htmlContent); - resolve({ html: htmlContent, text: textContent diff --git a/core/test/unit/config_spec.js b/core/test/unit/config_spec.js index 61589671ac..adf955d498 100644 --- a/core/test/unit/config_spec.js +++ b/core/test/unit/config_spec.js @@ -832,7 +832,7 @@ describe('Config', function () { it('displays warning when updateCheck exists and is falsy', function () { config.set({ - updateCheck: undefined + updateCheck: false }); // Run the test code config.checkDeprecated(); @@ -865,13 +865,14 @@ describe('Config', function () { it('displays warning when mail.fromaddress exists and is falsy', function () { config.set({ mail: { - fromaddress: undefined + fromaddress: false } }); // Run the test code config.checkDeprecated(); logStub.calledOnce.should.be.true; + logStub.calledWithMatch('mail.fromaddress').should.be.true; // Future tests: This is important here! diff --git a/core/test/utils/index.js b/core/test/utils/index.js index a80244204d..78b898a1ff 100644 --- a/core/test/utils/index.js +++ b/core/test/utils/index.js @@ -478,7 +478,9 @@ doAuth = function doAuth() { delete options[0]; // No DB setup, but override the owner options = _.merge({'owner:post': true}, _.transform(options, function (result, val) { - result[val] = true; + if (val) { + result[val] = true; + } })); fixtureOps = getFixtureOps(options); diff --git a/package.json b/package.json index 164737a469..192fb0173c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "bookshelf": "0.7.9", "busboy": "0.2.9", "chalk": "1.0.0", - "cheerio": "0.18.0", + "cheerio": "0.19.0", "compression": "1.4.4", "connect-slashes": "1.3.1", "cookie-session": "1.1.0", @@ -44,7 +44,7 @@ "glob": "4.3.2", "html-to-text": "1.3.0", "knex": "0.7.3", - "lodash": "2.4.1", + "lodash": "3.10.0", "moment": "2.10.3", "morgan": "1.5.3", "node-uuid": "1.4.3",