From 22306c4b195293bbd4d0285c6a4b73bac974ad7d Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 18 Jun 2021 15:37:42 +0100 Subject: [PATCH] Fixed type errors in post-email-serializer no issue - fixed errors showing in editor, no bugs just minor expected type differences --- core/server/services/mega/post-email-serializer.js | 8 ++++---- core/server/services/settings/cache.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/server/services/mega/post-email-serializer.js b/core/server/services/mega/post-email-serializer.js index 43c3d00d6f..83bc9bda64 100644 --- a/core/server/services/mega/post-email-serializer.js +++ b/core/server/services/mega/post-email-serializer.js @@ -151,7 +151,7 @@ const getLabsTemplateSettings = async () => { if (isUnsplashImage(templateSettings.headerImage)) { // Unsplash images have a minimum size so assuming 1200px is safe const unsplashUrl = new URL(templateSettings.headerImage); - unsplashUrl.searchParams.set('w', 1200); + unsplashUrl.searchParams.set('w', '1200'); templateSettings.headerImage = unsplashUrl.href; templateSettings.headerImageWidth = 600; @@ -217,7 +217,7 @@ const serialize = async (postModel, options = {isBrowserPreview: false, apiVersi if (isUnsplashImage(post.feature_image)) { // Unsplash images have a minimum size so assuming 1200px is safe const unsplashUrl = new URL(post.feature_image); - unsplashUrl.searchParams.set('w', 1200); + unsplashUrl.searchParams.set('w', '1200'); post.feature_image = unsplashUrl.href; post.feature_image_width = 600; @@ -249,7 +249,7 @@ const serialize = async (postModel, options = {isBrowserPreview: false, apiVersi let htmlTemplate = templateRenderer({post, site: getSite(), templateSettings}); if (options.isBrowserPreview) { - const previewUnsubscribeUrl = createUnsubscribeUrl(); + const previewUnsubscribeUrl = createUnsubscribeUrl(null); htmlTemplate = htmlTemplate.replace('%recipient.unsubscribe_url%', previewUnsubscribeUrl); } @@ -263,7 +263,7 @@ const serialize = async (postModel, options = {isBrowserPreview: false, apiVersi // force all links to open in new tab _cheerio('a').attr('target','_blank'); // convert figure and figcaption to div so that Outlook applies margins - _cheerio('figure, figcaption').each((i, elem) => (elem.tagName = 'div')); + _cheerio('figure, figcaption').each((i, elem) => !!(elem.tagName = 'div')); juicedHtml = _cheerio.html(); // Fix any unsupported chars in Outlook diff --git a/core/server/services/settings/cache.js b/core/server/services/settings/cache.js index 7ac00112d0..214de60e21 100644 --- a/core/server/services/settings/cache.js +++ b/core/server/services/settings/cache.js @@ -85,7 +85,7 @@ module.exports = { /** * Get the entire cache object * Uses clone to prevent modifications from being reflected - * @return {{}} cache + * @return {object} cache */ getAll() { return _.cloneDeep(settingsCache); @@ -94,7 +94,7 @@ module.exports = { /** * Get all the publically accessible cache entries with their correct names * Uses clone to prevent modifications from being reflected - * @return {{}} cache + * @return {object} cache */ getPublic() { let settings = {}; @@ -111,7 +111,7 @@ module.exports = { * Optionally takes a collection of settings & can populate the cache with these. * * @param {Bookshelf.Collection} [settingsCollection] - * @return {{}} + * @return {object} */ init(settingsCollection) { // First, reset the cache