-
Notifications
You must be signed in to change notification settings - Fork 823
Social | Classic editor connections schema changes #41778
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
Social | Classic editor connections schema changes #41778
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
Full summary · PHP report · JS report Add label
I don't care about code coverage for this PR
|
Since publicize package will always be the latest version regardless of whether there is an older version of a plugin, we can safely remove it.
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.
A few thoughts! But generally it's looking good
@@ -971,7 +969,7 @@ public function get_filtered_connection_data( $selected_post_id = null ) { | |||
* If this is a global connection and this user doesn't have enough permissions to modify | |||
* those connections, don't let them change it. | |||
*/ | |||
if ( ! $done && $this->is_global_connection( $connection_meta ) && ! current_user_can( $this->GLOBAL_CAP ) ) { | |||
if ( ! $done && $connection['shared'] && ! current_user_can( $this->GLOBAL_CAP ) ) { |
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.
Should we have a is_shared
method on the connection or something, so we remove the chance of typos etc? We're also mixing terms 'shared' and 'global'. It would be good to make sure we're only using one of those.
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.
Yeah, we can add a method to the connections class to check if a connection is shared.
<?php | ||
checked( true, $connection_data['enabled'] && $connection_healthy ); | ||
disabled( false, $connection_healthy ); |
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 is an interesting flaw currently. If we know that the connection is broken from the last test, then we should update the cache to show that. Currently the cache might have all connections with an ok
status, but the test-connections call then disabled it.
I think it's probably a follow-up though. It's how it also works in the block editor, but should we remove this disabled logic? Might it be better to update it to check that the status is ok?
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.
As mentioned above, the status is by default null
until connection tests are run.
May be in a separate change, we should use that connection test result call to save the connections list and then we could use the status field from there.
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, I don't think it's for this change, but we don't actually store the status of the connections now do we? So in the frontend, that's only reflected after the test connections call. I think we should update the connections cache with the result from the test connections call, and that should mean things update and jump around less.
We might want to check we're storing the status of the connections properly on WPCOM too, or we will try and share to broken connections. I think this bit is fine, but something to check while we're at it.
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.
Yeah, WPCOM part is going to be tricky.
projects/packages/publicize/src/js/classic-editor-connections.js
Outdated
Show resolved
Hide resolved
@@ -449,7 +449,7 @@ public function post_page_metabox() { | |||
$labels = array(); | |||
|
|||
foreach ( $connections_data as $connection_data ) { | |||
if ( ! $connection_data['enabled'] || ( isset( $connection_data['is_healthy'] ) && false === $connection_data['is_healthy'] ) ) { | |||
if ( ! $connection_data['enabled'] ) { |
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.
Should we be checking that the status is ok too?
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.
status
by default is null
and is now set only on connection test results.
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.
Right. Do you think it could be safer to check status here too? I feel like we should be storing that, so we'll just have to put this check back in when we do.
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.
Yeah, we can put that that back when it's implemented.
Code Coverage SummaryCoverage changed in 7 files. Only the first 5 are listed here.
Full summary · PHP report · JS report Add label
I don't care about code coverage for this PR
|
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 is working pretty well for me. I've not tested it in all environments yet though. Perhaps we could each take one of those to make sure it works as expected?
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.
Finally I could test it on Atomic too and seems to work fine
This PR contains all the changes we need for classic editor to use the new schema.
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
wpcom/v2
endpoint instead of Ajax