From ab81ffd324543112b5ca1315fd866b87ff2b9233 Mon Sep 17 00:00:00 2001 From: Gavin Suntop Date: Mon, 2 May 2022 18:14:07 +0000 Subject: [PATCH] Bug 1766040 - Clickable save for STP refresh r=thecount Differential Revision: https://phabricator.services.mozilla.com/D144995 --- .../js/components/ArticleList/ArticleList.jsx | 24 +++++++++++++++++-- .../panels/js/components/Home/Home.jsx | 1 + .../panels/js/components/Saved/Saved.jsx | 2 +- .../pocket/content/panels/js/main.bundle.js | 19 +++++++++++---- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/browser/components/pocket/content/panels/js/components/ArticleList/ArticleList.jsx b/browser/components/pocket/content/panels/js/components/ArticleList/ArticleList.jsx index 787c03bc43ede..2816a4b99df59 100644 --- a/browser/components/pocket/content/panels/js/components/ArticleList/ArticleList.jsx +++ b/browser/components/pocket/content/panels/js/components/ArticleList/ArticleList.jsx @@ -34,7 +34,15 @@ function Article(props) { : null; } - const { article, savedArticle, position, source, model, utmParams } = props; + const { + article, + savedArticle, + position, + source, + model, + utmParams, + openInPocketReader, + } = props; const url = new URL(article.url || article.resolved_url || ""); const urlSearchParams = new URLSearchParams(utmParams); for (let [key, val] of urlSearchParams.entries()) { @@ -51,10 +59,21 @@ function Article(props) { article.publisher || article.domain_metadata?.name || article.resolved_domain; + + let constructedURL = url.href; + + if ( + openInPocketReader && + article.item_id && + !url.href.match(/getpocket\.com\/read/) + ) { + constructedURL = `https://getpocket.com/read/${article.item_id}`; + } + return (
  • ))} diff --git a/browser/components/pocket/content/panels/js/components/Home/Home.jsx b/browser/components/pocket/content/panels/js/components/Home/Home.jsx index 03604105316a7..89f28255398de 100644 --- a/browser/components/pocket/content/panels/js/components/Home/Home.jsx +++ b/browser/components/pocket/content/panels/js/components/Home/Home.jsx @@ -95,6 +95,7 @@ function Home(props) { articles={articles.slice(0, 3)} source="home_recent_save" utmParams={utmParams} + openInPocketReader={true} />