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 1871/promo modal opt out notification #467

Merged
merged 2 commits into from Oct 28, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next

Display notification when user opts out of promos from a promo

  • Loading branch information
wlycdgr committed Oct 28, 2019
commit 90d133435bb7666dafa55ca1188caa06687d281c
@@ -2163,5 +2163,12 @@
"already_subscribed_sign_in": {
"message": "Already subscribed? Sign In",
"description": "Character limit: 28."
},
"promos_turned_off_notification": {
"message": "Promos turned off. You can turn them back on in",
"description": "translation must take into account that 'Settings' is appended to this string"
},
"settings": {
"message": "Settings"
}
}
@@ -12,8 +12,9 @@
*/

import React from 'react';
import { NavLink } from 'react-router-dom';
import Header from '../containers/HeaderContainer';
import { PlusPromoModal, Modal } from '../../shared-components';
import { PlusPromoModal } from '../../shared-components';
import InsightsPromoModal from './InsightsPromoModal';
import PlusUpgradePromoModal from './PlusUpgradePromoModal';
import { DynamicUIPortContext } from '../contexts/DynamicUIPortContext';
@@ -151,7 +152,6 @@ class Panel extends React.Component {
}
}


/**
* Helper render function for the notification callout
* @return {JSX} JSX for the notification callout
@@ -163,6 +163,9 @@ class Panel extends React.Component {
return (
<span>
<span key="0" dangerouslySetInnerHTML={{ __html: this.props.notificationText || t('panel_needs_reload') }} />
{this.props.notificationText === t('promos_turned_off_notification') && (
<NavLink className="settings-link" to="/settings/notifications" onClick={this.closeNotification}>{t('settings')}</NavLink>
)}
{needsReload && (
<div key="1" className="needs-reload-link" onClick={this.clickReloadBanner}>{ t('alert_reload') }</div>
)}
@@ -201,6 +204,12 @@ class Panel extends React.Component {
// TODO metrics ping
this.props.actions.togglePromoModal();
sendMessage('promoModals.turnOffPromos', {});

this.props.actions.showNotification({
classes: 'warning',
reload: false,
text: t('promos_turned_off_notification'),
});
};

_handlePromoSignInClick = (modal) => {
@@ -50,7 +50,10 @@ class Settings extends React.Component {
* Lifecycle event. Default sub view is set here.
*/
UNSAFE_componentWillMount() {
this.props.history.push('/settings/globalblocking');
// Do not redirect to the default if we are trying to access a specific other subview
if (this.props.history[this.props.history.length - 1] === '/settings') {
this.props.history.push('/settings/globalblocking');
}
}

/**
@@ -63,6 +63,7 @@
.needs-reload-link,
.filter-link,
.sign-in-link,
.settings-link,
.verify-account-link {
@extend %pointer;
margin-left: 5px;
ProTip! Use n and p to navigate between commits in a pull request.