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

Themes: sheet Support logic changes to include Jetpack #11294

Merged
merged 7 commits into from
Feb 14, 2017

Conversation

folletto
Copy link
Contributor

@folletto folletto commented Feb 9, 2017

This PR reviews the logic behind the "Support" tab in theme sheets, following the logic from #11263:

  1. Contact us — shown only if “Paid” and “Not Jetpack”
  2. Theme forum (Premium) — shown only if “Premium theme”
  3. Theme forum (general) — shown only if “.com theme” and “not Premium theme”
  4. CSS Support — shown only if “.com theme”

To test:

Please note there's a bug 🐞 currently that won't show the "Theme Forums" if the theme sheet isn't for a URL with a site (single site). Check everything else (update: fix in #11296).

Check one of each of the kinds above:

  1. Open /theme/textbook/support/$site (Free theme, Paid user) → should show "Need extra help?" + "Have a question (volounteers)?" + "Need CSS help?"
  2. Open /theme/shoreditch/support (Free theme, Free user) → should show "Need CSS help?" only
  3. Open /theme/shoreditch/support (Free theme, Paid user) → should show "Need extra help?" + "Need CSS help?"
  4. Open /theme/shoreditch/support/$jetpack (Free theme, JP site) → should show "Need CSS help?" only.
  5. Open /theme/$customtheme/support/$jetpack (Custom theme, JP site) → should show only the forum link for the custom theme

This list is probably not exhaustive, but should cover all the major cases.

@folletto folletto added [Feature Group] Appearance & Themes Features related to the appearance of sites. [Status] In Progress labels Feb 9, 2017
@folletto folletto added this to the Themes: JetPress Rally milestone Feb 9, 2017
@matticbot
Copy link
Contributor

matticbot commented Feb 9, 2017

@folletto folletto added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Feb 9, 2017
@folletto folletto self-assigned this Feb 9, 2017
@seear
Copy link
Contributor

seear commented Feb 9, 2017

Theme forum (Premium) — shown only if “Premium theme”
Theme forum (general) — shown only if “.com theme” and “not Premium theme”

Since there is no premium theme that is not also a .com theme, seems like we should show the forum for any .com theme, which gives us just this logic for the forum:

{ forumUrl && isWpcomTheme &&
    this.renderSupportThemeForumCard( buttonCount++ ) }

@seear
Copy link
Contributor

seear commented Feb 9, 2017

Seems that logic inside the getThemeForumUrl() selector needs a look. I don't think that it should be changing its return value based on whether a site is jetpack anymore.

edit: link

export function getThemeForumUrl( state, themeId, siteId ) {

@@ -644,6 +643,7 @@ export default connect(
( state, { id } ) => {
const selectedSite = getSelectedSite( state );
const siteSlug = selectedSite ? getSiteSlug( state, selectedSite.ID ) : '';
const isJetpack = selectedSite && isJetpackSite( state, selectedSite.ID );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the intermediate const here because the value is not used in this func. We can add it directly to the returned object below. Also, we should add isJetpack to the propTypes array at the start of the component.

</div>
);
}
let buttonCount = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should destructure the props into locals to give more concise code below, like this:

const { isCurrentUserPaid, isJetpack, forumUrl, isPremium, isWpcomTheme } = this.props;

@folletto
Copy link
Contributor Author

Since there is no premium theme that is not also a .com theme, seems like we should show the forum for any .com theme, which gives us just this logic for the forum:

Yeah true, I copied 1:1 the explanatory logic, but since it's the card that deals with the difference, no need there. Thanks!

Seems that logic inside the getThemeForumUrl() selector needs a look. I don't think that it should be changing its return value based on whether a site is jetpack anymore.

Seems ok to me... as a theme might be a custom one, so not a .org one, thus it might have no forum to refer to. Regardless, should it be a separate issue from this one?

We should destructure the props

We don't need the intermediate const

Done ✓ ✓

@folletto
Copy link
Contributor Author

folletto commented Feb 10, 2017

I also added a special case for logged out:

screen shot 2017-02-10 at 18 59 48


Ok it's ready for another code review. :)

Why? More granular conditions, supports properly Jetpack / uploaded
themes
Why? What if you see the support tab while logged out? Let's mention
what they are going to get if they start using our services.
@seear seear force-pushed the add/theme-sheet-jp-help branch from 87da4bb to 4522e21 Compare February 13, 2017 12:15
{ this.renderCssSupportCard() }
{ isCurrentUserPaid && ! isJetpack &&
this.renderSupportContactUsCard( buttonCount++ ) }
{ forumUrl && isWpcomTheme &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the isWpcomTheme check here? Currently I see nothing at all for custom themes on jetpack sites:

screen shot 2017-02-13 at 12 19 30

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's... correct in the sense that we aren't really able to provide support.

Maybe we can just see if there's a URL? Yes it might make sense, as it should point elsewhere if it's not a .com theme...

@folletto
Copy link
Contributor Author

folletto commented Feb 13, 2017

Ok fixed the condition on forumUrl — I also pushed a change that doesn't show the Support tab if it's empty. The conditions are 1:1 all the conditions form the other function, in a line. I'm not sure if it's a better way to do it, but the fact it's the same series without simplification should help maintenance later.

screen shot 2017-02-13 at 13 14 13

Ready for another review :)

const validSections = [];
validSections.push( '' ); // Default section
this.props.supportDocumentation && validSections.push( 'setup' );
validSections.push( 'support' );
( ! isLoggedIn || ( isCurrentUserPaid && ! isJetpack ) || forumUrl || isWpcomTheme ) && validSections.push( 'support' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

( ! isLoggedIn || ( isCurrentUserPaid && ! isJetpack ) || forumUrl || isWpcomTheme )

This logic seems a little fragile. Any time someone makes a tweak to the support UI logic below, they would have to know to change this line as well. Also this won't stop inbound links to /support.

Maybe we could have a default support message when none of the other cases apply?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's the reason why I'm a bit uncomfortable with that.

UX wise it's better overall to hide it — but ok, let me thing as a backup solution if I can come up with a message.

@folletto
Copy link
Contributor Author

folletto commented Feb 13, 2017

Ok, I replaced the Support tab hiding logic with this message:

screen shot 2017-02-13 at 17 49 56

Ready for another round. :)

Copy link
Contributor

@seear seear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good to ship 👍

@folletto folletto merged commit f10af25 into master Feb 14, 2017
@folletto folletto deleted the add/theme-sheet-jp-help branch February 14, 2017 10:54
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Appearance & Themes Features related to the appearance of sites.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants