Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1607/Remove feature listing #452

Merged
merged 6 commits into from Sep 25, 2019
Prev

Refactor switch to if/else. Modify language.

  • Loading branch information
benstrumeyer committed Sep 20, 2019
commit 511345293cf2334b8c2b2e2b2768010d79a9b340
@@ -1396,7 +1396,7 @@
"message": "New users are opted in to participating in Human Web and Ghostery Rewards. You may change these settings in custom setup or in the extension. "
},
"hub_home_header_info_cliqz": {
"message": "New users are opted in to participating in Human Web. You may change these settings in custom setup or in the extension. "
"message": "New users are opted in to participating in Human Web. You may change this setting in custom setup or in the extension. "
},
This conversation was marked as resolved by benstrumeyer

This comment has been minimized.

@wlycdgr

wlycdgr Sep 20, 2019
Member

Since we only mention one setting for Cliqz, it should be 'this setting' in the second sentence here.

This comment has been minimized.

@benstrumeyer

benstrumeyer Sep 20, 2019
Author Contributor

Gotcha, fixed.

"hub_home_header_info_link": {
"message": "Learn More."
@@ -35,17 +35,12 @@ const HomeView = (props) => {
} = props;
const accountHref = `https://account.${globals.GHOSTERY_DOMAIN}.com`;

let headerInfoText;
let headerInfoText = t('hub_home_header_info');
if (globals.BROWSER_INFO) {
switch (globals.BROWSER_INFO.name) {
case 'firefox':
headerInfoText = t('hub_home_header_info_opted_out');
break;
case 'cliqz':
headerInfoText = t('hub_home_header_info_cliqz');
break;
default:
headerInfoText = t('hub_home_header_info');
if (globals.BROWSER_INFO.name === 'firefox') {
headerInfoText = t('hub_home_header_info_opted_out');
} else if (globals.BROWSER_INFO.name === 'cliqz') {
headerInfoText = t('hub_home_header_info_cliqz');
}
}

This conversation was marked as resolved by benstrumeyer

This comment has been minimized.

@wlycdgr

wlycdgr Sep 20, 2019
Member

This introduces a dependency on globals.BROWSER_INFO being set compared to the old code; let's refactor to avoid doing that. We can do

let headerInfoText = t('hub_home_header_info');
if (globals.BROWSER_INFO) {
    // switching to if/else to avoid duplication in the default case of switch
    if (globals.BROWSER_INFO.name === 'firefox') { headerInfoText = ....}
    else if (.... === 'cliqz') { .....}
}

This comment has been minimized.

@benstrumeyer

benstrumeyer Sep 20, 2019
Author Contributor

Great catch. Fixed.

ProTip! Use n and p to navigate between commits in a pull request.