-
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
Jetpack Settings: Add notices for (de)activating Jetpack modules #10583
Conversation
/cc @MichaelArestad - we could use some feedback here for:
|
It seems simple enough to spot and modify. 'Infinite scroll has been enabled.' Is there any way we can make these messages more helpful? How does a user fix it? Might want an additional one for themes that don't support it (I think we may already do this in JP) CC @jeffgolenski |
@MichaelArestad thank you for the feedback!
Yes, of course! However, my plan for this PR was to lay the ground work for these notices. Then, in subsequent PRs we can start building more helpful and informative notices on a per-module basis. Does that sound like a good plan? |
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.
Code looks good.
This seems to be a solid baseline for activation / deactivation notices. I like how we have defaults in place, as well as the option to add specific notices on a per module basis.
To address Michael's feedback, I think we can work on writing more fine tuned notices in future PRs.
Thanks to Jetpack's awesome sync, we are syncing theme support options:
https://github.com/Automattic/jetpack/blob/master/sync/class.jetpack-sync-defaults.php#L258https://github.com/Automattic/jetpack/blob/master/sync/class.jetpack-sync-defaults.php#L258
So in theory, we can do exactly as Michael says for infinite scroll, and let folks in calypso know that their theme does not support it.
If you are fine with this as a baseline @MichaelArestad - can you mark it as "Ready to Merge" ?
Thanks for the feedback @roccotripaldi! @MichaelArestad can we get your feedback on this one? We've already deployed some cards, so I feel these notices are very necessary. |
I think it's okay. I'd like a second opinion on the defaults. Maybe @ashleighaxios can weigh in. |
I might adjust the language since the double negative is tricky (could not be disabled). Success: Failure: Alternative #2: Rather than allowing infinite scroll to turn on when it won't work, could we fail gracefully there? IE: 'Infinite scroll is not supported by your theme and could not be switched on. |
34adfab
to
69f348e
Compare
messageType = 'error'; | ||
break; | ||
case JETPACK_MODULE_DEACTIVATE_FAILURE: | ||
message = message || translate( 'An error occurred during deactivation.' ); |
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.
Alternate string suggestion:
translate( 'An error occurred while deactivating %(plugin)s on %(site)s.' )
— translations: 39. ES Score: 4.59
messageType = 'success'; | ||
break; | ||
case JETPACK_MODULE_ACTIVATE_FAILURE: | ||
message = message || translate( 'An error occurred during activation.' ); |
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.
Alternate string suggestion:
translate( 'An error occurred when activating %(plugin)s.' )
— translations: 19. ES Score: 4.92
messageType = 'success'; | ||
break; | ||
case JETPACK_MODULE_DEACTIVATE_SUCCESS: | ||
message = message || translate( 'Deactivated successfully.' ); |
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.
Alternate string suggestion:
translate( 'Successfully deactivated %(plugin)s on %(site)s.' )
— translations: 21. ES Score: 9.84
|
||
switch ( type ) { | ||
case JETPACK_MODULE_ACTIVATE_SUCCESS: | ||
message = message || translate( 'Activated successfully.' ); |
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.
Alternate string suggestion:
translate( 'Successfully activated %(plugin)s on %(site)s.' )
— translations: 21. ES Score: 8.76
@ashleighaxios I've updated the Infinite Scroll notices to the ones you recommended. However, I think @MichaelArestad requested a second opinion on the default notices, which we're trying to keep non-specific and as universal as possible, because they'll be used for any module that does not have a specific message. My initial suggestions were:
@ashleighaxios do you have any recommendations for improving these? |
export const MODULE_NOTICES = { | ||
'infinite-scroll': { | ||
[ ACTIVATE_SUCCESS ]: translate( 'Infinite scroll is now on.' ), | ||
[ DEACTIVATE_SUCCESS ]: translate( 'Infinite scroll is now off.' ), |
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.
Alternate string suggestion:
translate( 'Scroll Infinitely' )
— translations: 25. ES Score: 4.14
|
||
export const MODULE_NOTICES = { | ||
'infinite-scroll': { | ||
[ ACTIVATE_SUCCESS ]: translate( 'Infinite scroll is now on.' ), |
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.
Alternate string suggestion:
translate( 'Scroll Infinitely' )
— translations: 25. ES Score: 4.27
@MichaelArestad @ashleighaxios we already have several cards in the wild, so IMO it would be great if we could release some notices upon activation/deactivation of modules, just so users know that this is immediate and does not require saving. Do you folks feel there's anything that prevents this from landing? We could always improve these and build more granular notices once we have the infrastructure for that. |
@tyxla @MichaelArestad No objections from me. The new language works, what you're saying makes sense, and we're happy to adjust further down the road. |
@tyxla We could just match the language to @ashleighaxios's previous suggestions. "Turned on successfully" The error messages seem just fine, but hopefully we have specific errors for everything. |
48dfbfd
to
b8ae80f
Compare
@MichaelArestad @ashleighaxios thanks for the suggestions! I've improved the messages as you suggested, merging now. I'd be happy to implement better, more granular messages for modules in the future, so if you have any ideas, shoot away 😃 |
Purpose
This PR introduces a universal handler for dispatching notices upon activation and deactivation of Jetpack modules. This will allow us to configure specific notices on a per-module basis when activating/deactivating modules, but it will still default to a generic message if we haven't configured specific notices for a certain module. This PR is part of #9171.
Advantages and further configuration
This approach will allow easy configuration of the notices on a per-module basis - if one wishes to specify notices for a certain module, all that needs to be done is to add the following snippet to the
constants.js
file:where there are 5 strings to configure:
module-name
- the slug of the module - for exampleinfinite-scroll
,minileven
, etc.This PR adds an example set of specific notices for the
infinite-scroll
module. We can use them as basis for creating other specific notices.Preview
Successful activation of module with specific notices
Error during activation of module with specific notices
Successful activation of module without specific notices
Error during deactivation of module without specific notices
To test
dispatch( { type: 'JETPACK_MODULE_ACTIVATE_SUCCESS', moduleSlug: 'infinite-scroll' } )
dispatch( { type: 'JETPACK_MODULE_ACTIVATE_FAILURE', moduleSlug: 'infinite-scroll' } )
dispatch( { type: 'JETPACK_MODULE_DEACTIVATE_SUCCESS', moduleSlug: 'infinite-scroll' } )
dispatch( { type: 'JETPACK_MODULE_DEACTIVATE_FAILURE', moduleSlug: 'infinite-scroll' } )
dispatch( { type: 'JETPACK_MODULE_ACTIVATE_SUCCESS', moduleSlug: 'minileven' } )
dispatch( { type: 'JETPACK_MODULE_ACTIVATE_FAILURE', moduleSlug: 'minileven' } )
dispatch( { type: 'JETPACK_MODULE_DEACTIVATE_SUCCESS', moduleSlug: 'minileven' } )
dispatch( { type: 'JETPACK_MODULE_DEACTIVATE_FAILURE', moduleSlug: 'minileven' } )