Skip to content

Commit 3d25d65

Browse files
committed
Bug 1837224 - Remove suggested articles from STP r=thecount
Differential Revision: https://phabricator.services.mozilla.com/D180235
1 parent 266882e commit 3d25d65

File tree

5 files changed

+1
-171
lines changed

5 files changed

+1
-171
lines changed

browser/app/profile/firefox.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,8 +2207,6 @@ pref("extensions.pocket.enabled", true);
22072207
pref("extensions.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
22082208
pref("extensions.pocket.oAuthConsumerKeyBff", "94110-6d5ff7a89d72c869766af0e0");
22092209
pref("extensions.pocket.site", "getpocket.com");
2210-
pref("extensions.pocket.onSaveRecs", true);
2211-
pref("extensions.pocket.onSaveRecs.locales", "en-US,en-GB,en-CA");
22122210

22132211
// Enable Pocket button home panel for non link pages.
22142212
pref("extensions.pocket.showHome", true);

browser/components/pocket/content/panels/js/components/Saved/Saved.jsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function Saved(props) {
1919
useState({});
2020
const [savedStory, setSavedStoryState] = useState();
2121
const [articleInfoAttempted, setArticleInfoAttempted] = useState();
22-
const [{ similarRecs, similarRecsModel }, setSimilarRecsState] = useState({});
2322
const utmParams = `utm_source=${utmSource}${
2423
utmCampaign && utmContent
2524
? `&utm_campaign=${utmCampaign}&utm_content=${utmContent}`
@@ -91,19 +90,6 @@ function Saved(props) {
9190
}
9291
);
9392

94-
panelMessaging.addMessageListener("PKT_renderItemRecs", function (resp) {
95-
const { data } = resp;
96-
97-
// This is the ML model used to recommend the story.
98-
// Right now this value is the same for all three items returned together,
99-
// so we can just use the first item's value for all.
100-
const model = data?.recommendations?.[0]?.experiment || "";
101-
setSimilarRecsState({
102-
similarRecs: data?.recommendations?.map(rec => rec.item),
103-
similarRecsModel: model,
104-
});
105-
});
106-
10793
// tell back end we're ready
10894
panelMessaging.sendMessage("PKT_show_saved");
10995
}, []);
@@ -152,20 +138,6 @@ function Saved(props) {
152138
/>
153139
)}
154140
{articleInfoAttempted && <TagPicker tags={[]} itemUrl={itemUrl} />}
155-
{articleInfoAttempted &&
156-
similarRecs?.length &&
157-
locale?.startsWith("en") && (
158-
<>
159-
<hr />
160-
<h3 className="header_medium">Similar Stories</h3>
161-
<ArticleList
162-
articles={similarRecs}
163-
source="on_save_recs"
164-
model={similarRecsModel}
165-
utmParams={utmParams}
166-
/>
167-
</>
168-
)}
169141
</>
170142
)}
171143
{savedStatus === "loading" && (

browser/components/pocket/content/panels/js/main.bundle.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -791,10 +791,6 @@ function Saved(props) {
791791
}, setRemovedStatusState] = (0,react.useState)({});
792792
const [savedStory, setSavedStoryState] = (0,react.useState)();
793793
const [articleInfoAttempted, setArticleInfoAttempted] = (0,react.useState)();
794-
const [{
795-
similarRecs,
796-
similarRecsModel
797-
}, setSimilarRecsState] = (0,react.useState)({});
798794
const utmParams = `utm_source=${utmSource}${utmCampaign && utmContent ? `&utm_campaign=${utmCampaign}&utm_content=${utmContent}` : ``}`;
799795

800796
function removeItem(event) {
@@ -858,19 +854,6 @@ function Saved(props) {
858854
});
859855
messages.addMessageListener("PKT_getArticleInfoAttempted", function (resp) {
860856
setArticleInfoAttempted(true);
861-
});
862-
messages.addMessageListener("PKT_renderItemRecs", function (resp) {
863-
const {
864-
data
865-
} = resp; // This is the ML model used to recommend the story.
866-
// Right now this value is the same for all three items returned together,
867-
// so we can just use the first item's value for all.
868-
869-
const model = data?.recommendations?.[0]?.experiment || "";
870-
setSimilarRecsState({
871-
similarRecs: data?.recommendations?.map(rec => rec.item),
872-
similarRecsModel: model
873-
});
874857
}); // tell back end we're ready
875858

876859
messages.sendMessage("PKT_show_saved");
@@ -917,14 +900,7 @@ function Saved(props) {
917900
}), articleInfoAttempted && /*#__PURE__*/react.createElement(TagPicker_TagPicker, {
918901
tags: [],
919902
itemUrl: itemUrl
920-
}), articleInfoAttempted && similarRecs?.length && locale?.startsWith("en") && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("hr", null), /*#__PURE__*/react.createElement("h3", {
921-
className: "header_medium"
922-
}, "Similar Stories"), /*#__PURE__*/react.createElement(ArticleList_ArticleList, {
923-
articles: similarRecs,
924-
source: "on_save_recs",
925-
model: similarRecsModel,
926-
utmParams: utmParams
927-
}))), savedStatus === "loading" && /*#__PURE__*/react.createElement("h3", {
903+
})), savedStatus === "loading" && /*#__PURE__*/react.createElement("h3", {
928904
className: "header_large",
929905
"data-l10n-id": "pocket-panel-saved-saving-tags"
930906
}), removedStatus === "removing" && /*#__PURE__*/react.createElement("h3", {

browser/components/pocket/content/pktUI.js

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ ChromeUtils.defineESModuleGetters(this, {
5454
SaveToPocket: "chrome://pocket/content/SaveToPocket.sys.mjs",
5555
});
5656

57-
const POCKET_ONSAVERECS_PREF = "extensions.pocket.onSaveRecs";
58-
const POCKET_ONSAVERECS_LOCLES_PREF = "extensions.pocket.onSaveRecs.locales";
5957
const POCKET_HOME_PREF = "extensions.pocket.showHome";
6058

6159
var pktUI = (function () {
@@ -83,20 +81,9 @@ var pktUI = (function () {
8381
},
8482
};
8583

86-
var onSaveRecsEnabledPref;
87-
var onSaveRecsLocalesPref;
8884
var pocketHomePref;
8985

9086
function initPrefs() {
91-
onSaveRecsEnabledPref = Services.prefs.getBoolPref(
92-
POCKET_ONSAVERECS_PREF,
93-
false
94-
);
95-
onSaveRecsLocalesPref = Services.prefs.getStringPref(
96-
POCKET_ONSAVERECS_LOCLES_PREF,
97-
""
98-
);
99-
10087
pocketHomePref = Services.prefs.getBoolPref(POCKET_HOME_PREF);
10188
}
10289
initPrefs();
@@ -148,23 +135,6 @@ var pktUI = (function () {
148135
});
149136
}
150137

151-
/**
152-
* Get a list of recs for item and show them in the panel.
153-
*/
154-
function getAndShowRecsForItem(item, options) {
155-
var onSaveRecsEnabled =
156-
onSaveRecsEnabledPref && onSaveRecsLocalesPref.includes(getUILocale());
157-
158-
if (
159-
onSaveRecsEnabled &&
160-
item &&
161-
item.resolved_id &&
162-
item.resolved_id !== "0"
163-
) {
164-
pktApi.getRecsForItem(item.resolved_id, options);
165-
}
166-
}
167-
168138
/**
169139
* Show the logged-out state / sign-up panel
170140
*/
@@ -379,28 +349,6 @@ var pktUI = (function () {
379349
pktUIMessaging.sendMessageToPanel("PKT_getArticleInfoAttempted");
380350
}
381351
}
382-
383-
getAndShowRecsForItem(item, {
384-
success(data) {
385-
pktUIMessaging.sendMessageToPanel("PKT_renderItemRecs", data);
386-
if (data?.recommendations?.[0]?.experiment) {
387-
const payload = pktTelemetry.createPingPayload({
388-
// This is the ML model used to recommend the story.
389-
// Right now this value is the same for all three items returned together,
390-
// so we can just use the first item's value for all.
391-
model: data.recommendations[0].experiment,
392-
// Create an impression event for each item rendered.
393-
events: data.recommendations.map((item, index) => ({
394-
action: "impression",
395-
position: index,
396-
source: "on_save_recs",
397-
})),
398-
});
399-
// Send view impression ping.
400-
pktTelemetry.sendStructuredIngestionEvent(payload);
401-
}
402-
},
403-
});
404352
},
405353
error(error, request) {
406354
// If user is not authorized show singup page
@@ -619,7 +567,6 @@ var pktUI = (function () {
619567
onShowSignup,
620568
onShowHome,
621569

622-
getAndShowRecsForItem,
623570
tryToSaveUrl,
624571
tryToSaveCurrentPage,
625572
resizePanel,

browser/components/pocket/test/unit/browser_pocket_pktUI.js

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,69 +20,6 @@ function test_runner(test) {
2020
add_task(testTask);
2121
}
2222

23-
test_runner(async function test_pktUI_getAndShowRecsForItem_on({ sandbox }) {
24-
await SpecialPowers.pushPrefEnv({
25-
set: [["extensions.pocket.onSaveRecs", true]],
26-
});
27-
pktUI.initPrefs();
28-
const getRecsForItemStub = sandbox.stub(pktApi, "getRecsForItem");
29-
30-
pktUI.getAndShowRecsForItem(
31-
{
32-
resolved_id: "1234",
33-
},
34-
{
35-
success() {},
36-
}
37-
);
38-
39-
Assert.ok(getRecsForItemStub.calledOnce);
40-
Assert.equal(getRecsForItemStub.getCall(0).args[0], "1234");
41-
});
42-
43-
test_runner(async function test_pktUI_getAndShowRecsForItem_off({ sandbox }) {
44-
await SpecialPowers.pushPrefEnv({
45-
set: [["extensions.pocket.onSaveRecs", false]],
46-
});
47-
pktUI.initPrefs();
48-
const getRecsForItemStub = sandbox.stub(pktApi, "getRecsForItem");
49-
50-
pktUI.getAndShowRecsForItem(
51-
{
52-
resolved_id: "1234",
53-
},
54-
{
55-
success() {},
56-
}
57-
);
58-
59-
Assert.ok(getRecsForItemStub.notCalled);
60-
});
61-
62-
test_runner(async function test_pktUI_getAndShowRecsForItem_locale({
63-
sandbox,
64-
}) {
65-
await SpecialPowers.pushPrefEnv({
66-
set: [
67-
["extensions.pocket.onSaveRecs", true],
68-
["extensions.pocket.onSaveRecs.locales", "de"],
69-
],
70-
});
71-
pktUI.initPrefs();
72-
const getRecsForItemStub = sandbox.stub(pktApi, "getRecsForItem");
73-
74-
pktUI.getAndShowRecsForItem(
75-
{
76-
resolved_id: "1234",
77-
},
78-
{
79-
success() {},
80-
}
81-
);
82-
83-
Assert.ok(getRecsForItemStub.notCalled);
84-
});
85-
8623
test_runner(async function test_pktUI_showPanel({ sandbox }) {
8724
const testFrame = {
8825
setAttribute: sandbox.stub(),

0 commit comments

Comments
 (0)