From ef9a865e925bed772943698d38ced81268c9dacf Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 9 Oct 2019 16:23:21 +0200 Subject: [PATCH] fix #3115 @0:20 --- js/libs/fluidbook/fluidbook.share.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.share.js b/js/libs/fluidbook/fluidbook.share.js index 4a52d696..98bc4b51 100644 --- a/js/libs/fluidbook/fluidbook.share.js +++ b/js/libs/fluidbook/fluidbook.share.js @@ -104,7 +104,7 @@ FluidbookShare.prototype = { return this.fluidbook.datas.title; }, - getEmailSubject: function (context) { + getEmailSubject: function (url, context) { if (context === 'publication') { if (this.fluidbook.datas.email_title === '') { return this.fluidbook.datas.title; @@ -112,12 +112,15 @@ FluidbookShare.prototype = { return this.fluidbook.datas.email_title; } else if (context === 'product') { return this.fluidbook.datas.product_email_title; + } else if (context === 'article') { + return this.getSEOArticle(url).title; } }, getEmailBody: function (url, context) { var body; var u = this.getShareURL(url); + var title = this.fluidbook.datas.title; if (context === 'publication') { if (this.fluidbook.datas.email_body === '') { body = this.fluidbook.l10n.__('Veuillez cliquer sur le lien suivant pour ouvrir %title%\\n%link%'); @@ -126,9 +129,12 @@ FluidbookShare.prototype = { } } else if (context === 'product') { body = this.fluidbook.datas.product_email_body; + } else if (context === 'article') { + body = '%title%\\n%link%'; + title = this.getSEOArticle(url).title; } body = body.trim(); - body = body.replace(/\%title\%/g, this.fluidbook.datas.title); + body = body.replace(/\%title\%/g, title); if (body.indexOf('%link%') === -1) { body += "\n\n" + u; @@ -143,6 +149,9 @@ FluidbookShare.prototype = { }, getSEOArticle: function (title) { + if (title.indexOf('article:') === 0) { + title = title.substr(8); + } return this.fluidbook.datas.seoArticles[title]; }, @@ -181,7 +190,7 @@ FluidbookShare.prototype = { // Generate links for (var shareType in shareLinks) { if (shareLinks.hasOwnProperty(shareType)) { // Ensure we don't get inherited properties - shareHTML += '