Bug 1968947 - Dismiss personalized card if Inferred personalization is disabled from the customize menu a=dmeehan

Original Revision: https://phabricator.services.mozilla.com/D253215

Differential Revision: https://phabricator.services.mozilla.com/D253249
This commit is contained in:
Nathan Barrett
2025-06-11 20:12:47 +00:00
committed by dmeehan@mozilla.com
parent e9b6bb7ea0
commit b6ec1ebbe2
3 changed files with 11 additions and 5 deletions

View File

@@ -33,6 +33,8 @@ const PREF_LEADERBOARD_ENABLED = "newtabAdSize.leaderboard";
const PREF_LEADERBOARD_POSITION = "newtabAdSize.leaderboard.position";
const PREF_BILLBOARD_POSITION = "newtabAdSize.billboard.position";
const PREF_REFINED_CARDS_ENABLED = "discoverystream.refinedCardsLayout.enabled";
const PREF_INFERRED_PERSONALIZATION_USER =
"discoverystream.sections.personalization.inferred.user.enabled";
function getLayoutData(responsiveLayouts, index, refinedCardsLayout) {
let layoutData = {
@@ -458,7 +460,10 @@ function CardSections({
function displayP13nCard() {
if (messageData && Object.keys(messageData).length >= 1) {
if (messageData?.content?.messageType === "PersonalizedCard") {
if (
messageData?.content?.messageType === "PersonalizedCard" &&
prefs[PREF_INFERRED_PERSONALIZATION_USER]
) {
const row = messageData.content.position;
sectionsToRender.splice(
row,

View File

@@ -11270,6 +11270,7 @@ const CardSections_PREF_LEADERBOARD_ENABLED = "newtabAdSize.leaderboard";
const CardSections_PREF_LEADERBOARD_POSITION = "newtabAdSize.leaderboard.position";
const CardSections_PREF_BILLBOARD_POSITION = "newtabAdSize.billboard.position";
const PREF_REFINED_CARDS_ENABLED = "discoverystream.refinedCardsLayout.enabled";
const PREF_INFERRED_PERSONALIZATION_USER = "discoverystream.sections.personalization.inferred.user.enabled";
function getLayoutData(responsiveLayouts, index, refinedCardsLayout) {
let layoutData = {
classNames: [],
@@ -11627,7 +11628,7 @@ function CardSections({
}
function displayP13nCard() {
if (messageData && Object.keys(messageData).length >= 1) {
if (messageData?.content?.messageType === "PersonalizedCard") {
if (messageData?.content?.messageType === "PersonalizedCard" && prefs[PREF_INFERRED_PERSONALIZATION_USER]) {
const row = messageData.content.position;
sectionsToRender.splice(row, 0, /*#__PURE__*/external_React_default().createElement(MessageWrapper, {
dispatch: dispatch,
@@ -14300,7 +14301,7 @@ const Base_VISIBILITY_CHANGE_EVENT = "visibilitychange";
const Base_PREF_THUMBS_UP_DOWN_ENABLED = "discoverystream.thumbsUpDown.enabled";
const PREF_THUMBS_UP_DOWN_LAYOUT_ENABLED = "discoverystream.thumbsUpDown.searchTopsitesCompact";
const PREF_INFERRED_PERSONALIZATION_SYSTEM = "discoverystream.sections.personalization.inferred.enabled";
const PREF_INFERRED_PERSONALIZATION_USER = "discoverystream.sections.personalization.inferred.user.enabled";
const Base_PREF_INFERRED_PERSONALIZATION_USER = "discoverystream.sections.personalization.inferred.user.enabled";
const PrefsButton = ({
onClick,
icon
@@ -14814,7 +14815,7 @@ class BaseContent extends (external_React_default()).PureComponent {
const enabledSections = {
topSitesEnabled: prefs["feeds.topsites"],
pocketEnabled: prefs["feeds.section.topstories"],
showInferredPersonalizationEnabled: prefs[PREF_INFERRED_PERSONALIZATION_USER],
showInferredPersonalizationEnabled: prefs[Base_PREF_INFERRED_PERSONALIZATION_USER],
showRecentSavesEnabled: prefs.showRecentSaves,
topSitesRowsCount: prefs.topSitesRows,
weatherEnabled: prefs.showWeather

View File

@@ -234,7 +234,7 @@ module.exports = function (config) {
statements: 84.43,
lines: 83.9,
functions: 79.31,
branches: 53.62,
branches: 53.42,
},
"content-src/components/DiscoveryStreamComponents/SectionContextMenu/SectionContextMenu.jsx":
{