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-1895 and GH-1896: Midnight promos #485

Merged
merged 12 commits into from Dec 12, 2019

Do not show Premium promo to Premium subscribers

  • Loading branch information
wlycdgr committed Dec 12, 2019
commit 5377733042c86d099977df6f18c43e4462c1f20e
@@ -102,6 +102,17 @@ class HomeViewContainer extends Component {
*/
_handleTryMidnightClick = () => { this._handlePremiumPromoModalClick('premium'); }

/**
* @returns {bool}
* @private
* Is the user a Premium subscriber?
*/
_premiumSubscriber = () => {
const { loggedIn, user } = this.props;

return loggedIn && (user && user.scopes && user.scopes.includes('subscriptions:premium'));
}

_render() {
const { justInstalled } = this.state;
const { home, user } = this.props;
@@ -122,10 +133,12 @@ class HomeViewContainer extends Component {
isPlus,
};

const showPromoModal = !premium_promo_modal_shown && !this._premiumSubscriber();

return (
<div className="full-height">
<PremiumPromoModal
show={!premium_promo_modal_shown}
show={showPromoModal}
location="hub"
handleKeepBasicClick={this._handleKeepBasicClick}
handleGetPlusClick={this._handleGetPlusClick}
@@ -304,12 +304,25 @@ class Panel extends React.Component {
return loggedIn && (user && user.scopes && user.scopes.includes('subscriptions:insights'));
}

/**
* @returns {bool}
* @private
* Is the user a Premium subscriber?
*/
_premiumSubscriber = () => {
const { loggedIn, user } = this.props;

return loggedIn && (user && user.scopes && user.scopes.includes('subscriptions:premium'));
}

/**
* @returns {JSX}
* @private
* Renders the Premium promo modal
*/
_renderPremiumPromoModal = () => {
if (this._premiumSubscriber()) return null;

sendMessage('promoModals.sawPremiumPromo', {});

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