Skip to content
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

fix: correctly get default user role for settings selectbox #2949

Merged

Conversation

justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This PR fixes SettingsRegistry::callback_user_role_select() to correctly check $args['default'] for the default role to use.

Cherrypicked from @szepeviktor 's work in #2947

Does this close any currently open issues?

Supercedes #2497

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

Where has this been tested?

Operating System: Ubuntu 20.04 (wsl2 + devilbox + PHP 8.1.15 )

WordPress Version: 6.3.1

Co-authored-by: Viktor Szepe <viktor@szepe.net>
@justlevine justlevine added Type: Bug Something isn't working Status: In Review Needs to be reviewed by a project maintainer before merge labels Oct 2, 2023
@coveralls
Copy link

Coverage Status

coverage: 84.724%. remained the same when pulling 0003ffc on justlevine:fix/admin-default-user-role into 2937585 on wp-graphql:develop.

@jasonbahl jasonbahl added the Needs: Tests Tests should be added to ensure this works as expected label Oct 2, 2023
@jasonbahl
Copy link
Collaborator

We should add a test for this

@justlevine
Copy link
Collaborator Author

justlevine commented Oct 2, 2023

@jasonbahl confession time: I never got the acceptance/functional suite working locally bc of the hardcoded localhost references 🫣

I can find some time next week to sit down and finally configure it all and write this test, but if you (or anyone else) wants to beat me to it, commits are open on the branch 🤞

@jasonbahl
Copy link
Collaborator

haha! All good. I can try and work on a test as well.

…ts for the user role selects are loaded with the default values
@codeclimate
Copy link

codeclimate bot commented Oct 3, 2023

Code Climate has analyzed commit da55fa1 and detected 0 issues on this pull request.

View more on Code Climate.

@jasonbahl
Copy link
Collaborator

@justlevine I added a basic test. It tests the current implementation of the Settings API on the WPGraphQL Settings page, asserting that the 2 fields that use the user_role select load with the default value when the page is rendered.

@jasonbahl jasonbahl merged commit b6b7dfc into wp-graphql:develop Oct 3, 2023
26 checks passed
@justlevine justlevine deleted the fix/admin-default-user-role branch October 3, 2023 19:38
@jasonbahl jasonbahl mentioned this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Tests Tests should be added to ensure this works as expected Status: In Review Needs to be reviewed by a project maintainer before merge Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants