Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
feat(topstories): Hide preference section for unsupported locales
Browse files Browse the repository at this point in the history
  • Loading branch information
csadilek committed Jul 27, 2017
1 parent b3834bb commit 1fede7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ class PreferencesPane extends React.Component {
<PreferencesInput className="showTopSites" prefName="showTopSites" value={prefs.showTopSites} onChange={this.handleChange}
titleStringId="settings_pane_topsites_header" descStringId="settings_pane_topsites_body" />

{this.topStoriesOptions && <PreferencesInput className="showTopStories" prefName="feeds.section.topstories"
value={prefs["feeds.section.topstories"]} onChange={this.handleChange}
titleStringId="header_recommended_by" titleStringValues={{provider: this.topStoriesOptions.provider_name}}
descStringId={this.topStoriesOptions.provider_description} />}
{this.topStoriesOptions && !this.topStoriesOptions.hidden &&
<PreferencesInput className="showTopStories" prefName="feeds.section.topstories"
value={prefs["feeds.section.topstories"]} onChange={this.handleChange}
titleStringId="header_recommended_by" titleStringValues={{provider: this.topStoriesOptions.provider_name}}
descStringId={this.topStoriesOptions.provider_description} />}
</div>
<section className="actions">
<button className="done" onClick={this.togglePane}>
Expand Down
8 changes: 5 additions & 3 deletions system-addon/lib/ActivityStream.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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());
// Sections, keyed by section id
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
}]
]);

Expand Down Expand Up @@ -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}
}`
}],
["migrationExpired", {
Expand Down

0 comments on commit 1fede7c

Please sign in to comment.