From c3463b382d3eeaa24c6409a9a9871ad2f67e12b6 Mon Sep 17 00:00:00 2001 From: Kid Date: Thu, 8 Aug 2019 22:05:24 +0800 Subject: [PATCH] fix: remove `
` in Twitter tweet title (#2796) --- lib/routes/twitter/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/routes/twitter/utils.js b/lib/routes/twitter/utils.js index d4bdf17173..6a83d60e02 100644 --- a/lib/routes/twitter/utils.js +++ b/lib/routes/twitter/utils.js @@ -27,7 +27,7 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => { } }; - const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, '
'); + const formatText = (text, br) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, br); const formatVideo = (media) => { let content = ''; const video = media.video_info.variants.reduce((video, item) => { @@ -71,7 +71,7 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => { const formatUrl = (item) => { let url = ''; item.entities.urls.forEach((u) => { - url += `${u.expanded_url}`; + url += `${u.expanded_url}`; }); return url; @@ -100,10 +100,10 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => { } return { - title: `${showAuthor ? item.user.name + ': ' : ''}${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}`, + title: `${showAuthor ? item.user.name + ': ' : ''}${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text, '')}`, description: `${showAuthor ? `${item.user.name}:

` : ''}${ item.in_reply_to_screen_name ? 'Re ' : '' - }${formatText(item.full_text)}${url}${img}${quote}`, + }${formatText(item.full_text, '
')}${url}${img}${quote}`, pubDate: new Date(item.created_at).toUTCString(), link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`, };