0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Fixed type errors in post-email-serializer

no issue

- fixed errors showing in editor, no bugs just minor expected type differences
This commit is contained in:
Kevin Ansfield 2021-06-18 15:37:42 +01:00
parent a457631a20
commit 22306c4b19
2 changed files with 7 additions and 7 deletions

View file

@ -151,7 +151,7 @@ const getLabsTemplateSettings = async () => {
if (isUnsplashImage(templateSettings.headerImage)) { if (isUnsplashImage(templateSettings.headerImage)) {
// Unsplash images have a minimum size so assuming 1200px is safe // Unsplash images have a minimum size so assuming 1200px is safe
const unsplashUrl = new URL(templateSettings.headerImage); const unsplashUrl = new URL(templateSettings.headerImage);
unsplashUrl.searchParams.set('w', 1200); unsplashUrl.searchParams.set('w', '1200');
templateSettings.headerImage = unsplashUrl.href; templateSettings.headerImage = unsplashUrl.href;
templateSettings.headerImageWidth = 600; templateSettings.headerImageWidth = 600;
@ -217,7 +217,7 @@ const serialize = async (postModel, options = {isBrowserPreview: false, apiVersi
if (isUnsplashImage(post.feature_image)) { if (isUnsplashImage(post.feature_image)) {
// Unsplash images have a minimum size so assuming 1200px is safe // Unsplash images have a minimum size so assuming 1200px is safe
const unsplashUrl = new URL(post.feature_image); 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 = unsplashUrl.href;
post.feature_image_width = 600; post.feature_image_width = 600;
@ -249,7 +249,7 @@ const serialize = async (postModel, options = {isBrowserPreview: false, apiVersi
let htmlTemplate = templateRenderer({post, site: getSite(), templateSettings}); let htmlTemplate = templateRenderer({post, site: getSite(), templateSettings});
if (options.isBrowserPreview) { if (options.isBrowserPreview) {
const previewUnsubscribeUrl = createUnsubscribeUrl(); const previewUnsubscribeUrl = createUnsubscribeUrl(null);
htmlTemplate = htmlTemplate.replace('%recipient.unsubscribe_url%', previewUnsubscribeUrl); 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 // force all links to open in new tab
_cheerio('a').attr('target','_blank'); _cheerio('a').attr('target','_blank');
// convert figure and figcaption to div so that Outlook applies margins // 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(); juicedHtml = _cheerio.html();
// Fix any unsupported chars in Outlook // Fix any unsupported chars in Outlook

View file

@ -85,7 +85,7 @@ module.exports = {
/** /**
* Get the entire cache object * Get the entire cache object
* Uses clone to prevent modifications from being reflected * Uses clone to prevent modifications from being reflected
* @return {{}} cache * @return {object} cache
*/ */
getAll() { getAll() {
return _.cloneDeep(settingsCache); return _.cloneDeep(settingsCache);
@ -94,7 +94,7 @@ module.exports = {
/** /**
* Get all the publically accessible cache entries with their correct names * Get all the publically accessible cache entries with their correct names
* Uses clone to prevent modifications from being reflected * Uses clone to prevent modifications from being reflected
* @return {{}} cache * @return {object} cache
*/ */
getPublic() { getPublic() {
let settings = {}; let settings = {};
@ -111,7 +111,7 @@ module.exports = {
* Optionally takes a collection of settings & can populate the cache with these. * Optionally takes a collection of settings & can populate the cache with these.
* *
* @param {Bookshelf.Collection<Settings>} [settingsCollection] * @param {Bookshelf.Collection<Settings>} [settingsCollection]
* @return {{}} * @return {object}
*/ */
init(settingsCollection) { init(settingsCollection) {
// First, reset the cache // First, reset the cache