-
Notifications
You must be signed in to change notification settings - Fork 112
feat(topstories): Hide preference section for unsupported locales #3002
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh neat. I was worried that we needed to have some new common/constants.jsm
or something.
system-addon/lib/ActivityStream.jsm
Outdated
const SECTIONS = new Map([ | ||
["topstories", { | ||
feed: TopStoriesFeed, | ||
prefTitle: "Fetches content recommendations from a configurable content provider", | ||
// for now, we only want to show top stories by default to the following locales | ||
showByDefault: ["en-US", "en-CA"].includes(Services.locale.getRequestedLocale()) | ||
showByDefault: showTopStoriesByDefault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the default inline with topstories, i.e., undo this change. So that the comment line makes sense.
@@ -84,7 +85,8 @@ const PREFS_CONFIG = new Map([ | |||
"api_key_pref": "extensions.pocket.oAuthConsumerKey", | |||
"provider_name": "Pocket", | |||
"provider_icon": "pocket", | |||
"provider_description": "pocket_feedback_body" | |||
"provider_description": "pocket_feedback_body", | |||
"hidden": ${!showTopStoriesByDefault} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead just do ${!SECTIONS.get("topstories").showByDefault}
@@ -24,13 +24,14 @@ const {TopStoriesFeed} = Cu.import("resource://activity-stream/lib/TopStoriesFee | |||
|
|||
const REASON_ADDON_UNINSTALL = 6; | |||
|
|||
// For now, we only want to show top stories by default to the following locales | |||
const showTopStoriesByDefault = ["en-US", "en-CA"].includes(Services.locale.getRequestedLocale()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine with the comment line moved up.
Suggestion for a simple fix #2973.
Reason I used "hidden" (negated showByDefault) is so nobody has to reset their prefs to keep seeing top stories.