-
Notifications
You must be signed in to change notification settings - Fork 800
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
Subscribe block: Hide social followers toggle when showSubscribersTotal is not on or isPublicizeEnabled is false #28944
Conversation
…tal is not toggled or isPublicizeEnabled is false
…tal is not toggled or isPublicizeEnabled is false
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run
to get started. More details: p9dueE-5Nn-p2 |
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
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.
Works as described.
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.
Looks like bringing this in breaks the tests:
https://github.com/Automattic/jetpack/actions/runs/4174632935/jobs/7228468442
We'll consequently need to update those to be able to merge this.
Hey @jeherve This seems to break on something unrelated:
What's the best way for me to fix this? |
That's a good question! I don't know. I wonder if mocking the new hook you're bringing in would solve our problem, so the new package doesn't have to be pulled in. @glendaviesnz Sorry for the ping! I wonder if you would have some pointers for us on this testing problem :) |
No worries, sorry about the delay in replying, I have been AFK, will try and take a look today and get back to you. |
This commit seems to get rid of the scss import errors. Taken from here jestjs/jest#3094 (comment) I also tried the other option of using There are a couple of other @WordPress import errors still which I haven't got time to look at today, but let me know if you need any help with those and I will take a look tomorrow. |
🙏 Thanks for the fix. I mocked However, now I'm running into
This seems the same thing that's blocking this PR, and I honestly don't have a clue about how to fix this. Don you have any suggestions? |
@adamziel do you have any thoughts on the best way to suppress these errors? I did look at the docs but could not work out how to knowingly opt-in from the plugin end. In the case of the Jetpack blocks I think there is an understanding of the risks of using these experimental APIs, and backing out of them at this point may not be feasible. |
@glendaviesnz That check fails when the same module opts-in to the private APIs twice. When it fails, it could be a symptom of having two different versions of the That being said, this Gutenberg PR disables this strict check in |
@TimBroddin let me know if hunting out the duplicate dependency, or updating the |
The JS tests seem to pass now! |
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.
This tests well for me. 🚢
{ showSubscribersTotal && isPublicizeEnabled ? ( | ||
<ToggleControl | ||
disabled={ ! showSubscribersTotal } | ||
label={ __( 'Include social followers in count', 'jetpack' ) } | ||
checked={ includeSocialFollowers } | ||
onChange={ () => { | ||
setAttributes( { includeSocialFollowers: ! includeSocialFollowers } ); | ||
} } | ||
/> | ||
) : null } |
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.
This will not work for published posts on simple sites with a free plan because isPublicizeEnabled
is more like a local state whether sharing is enabled for the post or not. For published posts, this flag is false
if re-sharing is not enabled. For simple sites, resharing is not enabled with free plan.
You can check its source in usePublicizeConfig
.
The correct solution here might to check if publicize
module is active.
CC: @jeherve
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.
The correct solution here might to check if publicize module is active.
This may indeed be a better solution, and we now have useModuleStatus
to help with that. @Automattic/zap Is that something you could look into?
Thank you!
Fixes #28725
Proposed changes:
This PR hides the "Include social followers in count" when "Show subscribers count" is off, or when Publicize is not enabled.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No
Testing instructions: