-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
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:
|
Seems that logic inside the edit: link wp-calypso/client/state/themes/selectors.js Line 474 in b23a70a
|
client/my-sites/theme/main.jsx
Outdated
@@ -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 ); |
There was a problem hiding this comment.
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.
client/my-sites/theme/main.jsx
Outdated
</div> | ||
); | ||
} | ||
let buttonCount = 1; |
There was a problem hiding this comment.
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;
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 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?
Done ✓ ✓ |
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.
87da4bb
to
4522e21
Compare
client/my-sites/theme/main.jsx
Outdated
{ this.renderCssSupportCard() } | ||
{ isCurrentUserPaid && ! isJetpack && | ||
this.renderSupportContactUsCard( buttonCount++ ) } | ||
{ forumUrl && isWpcomTheme && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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...
Ok fixed the condition on Ready for another review :) |
client/my-sites/theme/main.jsx
Outdated
const validSections = []; | ||
validSections.push( '' ); // Default section | ||
this.props.supportDocumentation && validSections.push( 'setup' ); | ||
validSections.push( 'support' ); | ||
( ! isLoggedIn || ( isCurrentUserPaid && ! isJetpack ) || forumUrl || isWpcomTheme ) && validSections.push( 'support' ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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 👍
This PR reviews the logic behind the "Support" tab in theme sheets, following the logic from #11263:
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:
/theme/textbook/support/$site
(Free theme, Paid user) → should show "Need extra help?" + "Have a question (volounteers)?" + "Need CSS help?"/theme/shoreditch/support
(Free theme, Free user) → should show "Need CSS help?" only/theme/shoreditch/support
(Free theme, Paid user) → should show "Need extra help?" + "Need CSS help?"/theme/shoreditch/support/$jetpack
(Free theme, JP site) → should show "Need CSS help?" only./theme/$customtheme/support/$jetpack
(Custom theme, JP site) → should show only the forum link for the custom themeThis list is probably not exhaustive, but should cover all the major cases.