Skip to content

feat: allow global/db ids in comment mutation ID inputs#2328

Merged
jasonbahl merged 2 commits intowp-graphql:developfrom
justlevine:feat/comment-mutation-id-inputs
May 3, 2022
Merged

feat: allow global/db ids in comment mutation ID inputs#2328
jasonbahl merged 2 commits intowp-graphql:developfrom
justlevine:feat/comment-mutation-id-inputs

Conversation

@justlevine
Copy link
Copy Markdown
Collaborator

What does this implement/fix? Explain your changes.

This PR enables users to supply either a database ID or a global ID to comment mutation inputs of type ID. Part of #998 .
The description of commentOn was changed to specify it only takes a database ID (until #532 can be handled).
Also a new test was added for creating child comments.

Does this close any currently open issues?

Invalidates #2195

Any other comments?

Where has this been tested?

Operating System: Ubuntu 20.04 (Wsl2 + devilbox + PHP 8.0.15)

WordPress Version: 5.9.2

@justlevine justlevine added type: enhancement Improvements to existing functionality needs: reviewer response This needs the attention of a codeowner or maintainer component: mutations Relating to GraphQL Mutations object type: comment Relating to the Comment Type scope: api Issues related to access functions, actions, and filters labels Apr 5, 2022
@justlevine
Copy link
Copy Markdown
Collaborator Author

@jasonbahl this is proof of concept Once I get feedback/approval on this, I'll start work on the other mutations, then connections.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 5, 2022

Coverage Status

Coverage increased (+0.03%) to 79.299% when pulling 7985677 on justlevine:feat/comment-mutation-id-inputs into 2ee200f on wp-graphql:develop.

jasonbahl
jasonbahl previously approved these changes Apr 5, 2022
Copy link
Copy Markdown
Collaborator

@jasonbahl jasonbahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justlevine this is wonderful! 👏🏻

I like the iterative approach you're taking as well, tackling small bits at a time.

Have you done a pretty thorough audit and have a list of all the fields that need to be addressed?

I wonder if it might make sense to create a feature branch for this, which is opened as a PR to develop, then we can make small iterative PRs to that feature branch, and work toward a larger merge with several of these PRs accumulated?

Maybe use one Issue and some checkboxes as well to track what inputs need to be changed, etc?

Could help us with this current phase, but also help us set up for when we're ready to make the breaking changes (changing Int to ID in various places).

@qlty-cloud-legacy
Copy link
Copy Markdown

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

View more on Code Climate.

@justlevine justlevine force-pushed the feat/comment-mutation-id-inputs branch from 5ca7196 to 7985677 Compare April 5, 2022 21:18
@justlevine
Copy link
Copy Markdown
Collaborator Author

Sorry, accidentally pushed media items to this PR, just reverted.

Have you done a pretty thorough audit and have a list of all the fields that need to be addressed?

I was going to, but then I realized its just a simple search for => 'ID'.
image

I can take a beat and write them out if you want.

I wonder if it might make sense to create a feature branch for this, which is opened as a PR to develop, then we can make small iterative PRs to that feature branch, and work toward a larger merge with several of these PRs accumulated?

Your call. I personally try to avoid feature branches whenever for the same reason I'm submitting these PRs piecemeal - merge conflicts are a PITA.

If you're looking to prep for a near-term release and are worried about confusing users by enhancing the mutations/connection args incrementally, then feature branch is probably the way to go. But I can also make the argument that since the accepted ID inputs are confusing users in their current state, so even if they were added incrementally over a few releases, it'd still lessen the confusion. 🤷‍♂️

Without being too optimistic, updating mutation inputs is pretty straightforward. The only thing that might slow me down is backfilling missing tests.

Connections are going require a larger discussion over in #998 - the question of where in the lifecycle to make the change needs to be thought out foundationally (e.g. is the db or global id saved to $query_args['graphql_args']), and on an individual basis (even with AbstractConnectionResolver, each connection have their own order for calling parent methods / processing the args).

@justlevine justlevine added the status: in review Awaiting review before merging or closing label Apr 25, 2022
@jasonbahl jasonbahl merged commit 16b9945 into wp-graphql:develop May 3, 2022
@justlevine justlevine deleted the feat/comment-mutation-id-inputs branch May 3, 2022 23:52
@jasonbahl jasonbahl mentioned this pull request May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: mutations Relating to GraphQL Mutations needs: reviewer response This needs the attention of a codeowner or maintainer object type: comment Relating to the Comment Type scope: api Issues related to access functions, actions, and filters status: in review Awaiting review before merging or closing type: enhancement Improvements to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants