-
Notifications
You must be signed in to change notification settings - Fork 157
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
Limited external connection warning incorrect #1140
Conversation
… external connections
@peterwilsoncc I tried to run the cypress tests locally but wasn't able to so I'm not sure if I need to make any additional setup configuration to run them properly. Here's the error that I get when I run Also, is this the test I would need to update? |
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.
Thanks for the PR, Luca.
This is my fault but I the rest-api endpoint needs an update in the function check_post_types_permissions()
, the permission check loop should be:
foreach ( $types as $type ) {
$caps = $type->cap;
if ( current_user_can( $caps->edit_posts ) ) {
$response['can_post'][] = $type->name;
}
if ( current_user_can( $caps->edit_posts ) && current_user_can( $caps->create_posts ) && current_user_can( $caps->publish_posts ) ) {
$response['can_post'][] = $type->name;
}
}
While testing, I noticed that if Distributor is not installed it shows the old limited connection message, as in this screenshot. This too will need to be updated to an error.
You're correct, the test you've linked to in external-connection.test.js
is the one that needs an update.
Getting Cypress running locally can be a little fiddly, were you able to get the environment running in Docker or did it fail before then?
Hey @peterwilsoncc, thanks for your feedback. I made an update to show an error for the use case you mentioned above (when distributor is not installed). I also updated the RE: Cypress Tests – I only ran |
The E2E tests use distributor/tests/cypress/config.js Lines 29 to 48 in 0387c94
I can take a look at the changes required. |
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.
I retested and was still seeing some unexpected warnings rather than errors, so have added a few more suggestions.
With these changes, I think we'll then be able to remove the else if
beginning on line 367 -- it's outside the diff so I'm unable to include it as an inline suggestion.
Co-authored-by: Peter Wilson <[email protected]>
@peterwilsoncc thanks again for your feedback. I implemented the changes you suggested but wasn't totally sure we could remove the re: tests - I was able to run the tests this time by running |
Yes, that's what I was after. The two conditions A downside to switching to the dedicated Distributor endpoint is that it's basically all-or-nothing for connections at the moment. They'll either error or succeed, we're no longer able to have the partial connections that used to trigger warnings. As the block-editor becomes more important, the partial connections of old become less effective as the block editor requires access to the raw content.
I'll test from scratch locally and reach out via the 10up Slack. It's possible the docs need to be updated. |
Thanks @peterwilsoncc, I've updated the code and removed the warnings since they aren't applicable anymore. I also updated the tests and removed the test for warnings. |
For others, these are the steps currently required to get the commands required to get e2e tests running locally. Please ensure Docker is running before running these commands.
|
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.
Thanks Luca, this looks good to me.
Thanks for your patience during the review process, quite a bit had changed.
Description of the Change
Closes #1071
How to test the Change
Authentication failed due to insufficient or invalid credentials.
message insteadChangelog Entry
Credits
Props @theskinnyghost
Checklist: