Bug 1613093 - Fixing Navigation componenet and locale prop. r=Mardak

Differential Revision: https://phabricator.services.mozilla.com/D63511

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Scott 2020-02-20 21:38:53 +00:00
Родитель 7f634ba2c0
Коммит d2b6fe9743
8 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -20,6 +20,7 @@ const INITIAL_STATE = {
App: {
// Have we received real data from the app yet?
initialized: false,
locale: "",
},
ASRouter: { initialized: false },
Snippets: { initialized: false },

Просмотреть файл

@ -21,7 +21,6 @@ ReactDOM.hydrate(
<Provider store={store}>
<Base
isFirstrun={global.document.location.href === "about:welcome"}
locale={global.document.documentElement.lang}
strings={global.gActivityStreamStrings}
/>
</Provider>,

Просмотреть файл

@ -174,7 +174,7 @@ export class BaseContent extends React.PureComponent {
<div className={`body-wrapper${initialized ? " on" : ""}`}>
{isDiscoveryStream ? (
<ErrorBoundary className="borderless-error">
<DiscoveryStreamBase />
<DiscoveryStreamBase locale={props.App.locale} />
</ErrorBoundary>
) : (
<Sections />

Просмотреть файл

@ -304,7 +304,7 @@ export class _DiscoveryStreamBase extends React.PureComponent {
state: this.props.DiscoveryStream,
prefs: this.props.Prefs.values,
rollCache,
lang: this.props.document.documentElement.lang,
locale: this.props.locale,
});
const { config, spocs, feeds } = this.props.DiscoveryStream;

Просмотреть файл

@ -6,7 +6,7 @@ export const selectLayoutRender = ({
state = {},
prefs = {},
rollCache = [],
lang = "",
locale = "",
}) => {
const { layout, feeds, spocs } = state;
let spocIndexMap = {};
@ -68,7 +68,7 @@ export const selectLayoutRender = ({
filterArray.push("TopSites");
}
if (!lang.startsWith("en-")) {
if (!locale.startsWith("en-")) {
filterArray.push("Navigation");
}

Просмотреть файл

@ -122,7 +122,6 @@ react_dom__WEBPACK_IMPORTED_MODULE_6___default.a.hydrate(react__WEBPACK_IMPORTED
store: store
}, react__WEBPACK_IMPORTED_MODULE_5___default.a.createElement(content_src_components_Base_Base__WEBPACK_IMPORTED_MODULE_1__["Base"], {
isFirstrun: global.document.location.href === "about:welcome",
locale: global.document.documentElement.lang,
strings: global.gActivityStreamStrings
})), document.getElementById("root"));
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1)))
@ -727,7 +726,9 @@ class BaseContent extends react__WEBPACK_IMPORTED_MODULE_7___default.a.PureCompo
className: `body-wrapper${initialized ? " on" : ""}`
}, isDiscoveryStream ? react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_ErrorBoundary_ErrorBoundary__WEBPACK_IMPORTED_MODULE_6__["ErrorBoundary"], {
className: "borderless-error"
}, react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_DiscoveryStreamBase_DiscoveryStreamBase__WEBPACK_IMPORTED_MODULE_5__["DiscoveryStreamBase"], null)) : react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_Sections_Sections__WEBPACK_IMPORTED_MODULE_9__["Sections"], null), react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(PrefsButton, {
}, react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_DiscoveryStreamBase_DiscoveryStreamBase__WEBPACK_IMPORTED_MODULE_5__["DiscoveryStreamBase"], {
locale: props.App.locale
})) : react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_Sections_Sections__WEBPACK_IMPORTED_MODULE_9__["Sections"], null), react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(PrefsButton, {
onClick: this.openPreferences
})), react__WEBPACK_IMPORTED_MODULE_7___default.a.createElement(content_src_components_ConfirmDialog_ConfirmDialog__WEBPACK_IMPORTED_MODULE_3__["ConfirmDialog"], null))));
}
@ -4383,7 +4384,7 @@ class _DiscoveryStreamBase extends react__WEBPACK_IMPORTED_MODULE_14___default.a
state: this.props.DiscoveryStream,
prefs: this.props.Prefs.values,
rollCache,
lang: this.props.document.documentElement.lang
locale: this.props.locale
});
const {
config,
@ -10235,7 +10236,7 @@ const selectLayoutRender = ({
state = {},
prefs = {},
rollCache = [],
lang = ""
locale = ""
}) => {
const {
layout,
@ -10296,7 +10297,7 @@ const selectLayoutRender = ({
filterArray.push("TopSites");
}
if (!lang.startsWith("en-")) {
if (!locale.startsWith("en-")) {
filterArray.push("Navigation");
}
@ -14359,7 +14360,8 @@ const dedupe = new Dedupe(site => site && site.url);
const INITIAL_STATE = {
App: {
// Have we received real data from the app yet?
initialized: false
initialized: false,
locale: ""
},
ASRouter: {
initialized: false

Просмотреть файл

@ -692,7 +692,9 @@ this.ActivityStream = class ActivityStream {
this.feeds,
ac.BroadcastToContent({
type: at.INIT,
data: {},
data: {
locale: this.locale,
},
}),
{ type: at.UNINIT }
);

Просмотреть файл

@ -102,6 +102,7 @@ describe("<DiscoveryStreamBase>", () => {
};
return shallow(
<DiscoveryStreamBase
locale="en-US"
DiscoveryStream={defaultProps}
Prefs={{
values: {