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

Issue#8 comment mutations #465

Merged
merged 23 commits into from
Jul 20, 2018

Conversation

kidunot89
Copy link
Member

Your checklist for this pull request

Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.

🚨Please review the guidelines for contributing to this repository.

  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Make sure you are requesting to pull request from a topic/feature/bugfix branch (right side). Don't pull request from your master!

What does this implement/fix? Explain your changes.

CommentMutations, CreateComment, UpdateComment, DeleteComment, UntrashComment, and CommentMutationTests

Does this close any currently open issues?

Issue #8

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

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?

I don't believe the CommentConnections are fully implemented. I couldn't figure out how to access the posts through the commentedOn property or the author/user through the author property. The implemention lays outside the scope of the mutations though.

Where has this been tested?

Operating System: Ubuntu 18.04

WordPress Version: 4.9.6

@kidunot89 kidunot89 closed this Jul 5, 2018
@kidunot89 kidunot89 reopened this Jul 5, 2018
Copy link
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.

@kidunot89 thanks so much for working on this!

I left some initial comments on the Composer dependencies and some formatting changes.

I'll pull this down and check things out in more detail and provide more feedback soon.

Thanks!

return $content;
}

return apply_filters('comment_text', $content);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@kidunot89 good addition! We need to also support the format argument for this field then

Copy link
Member Author

@kidunot89 kidunot89 Jul 6, 2018

Choose a reason for hiding this comment

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

I already added support for that. It's there as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kidunot89 where? I don't see it in this diff unless I'm overlooking something 🤔 👀

I would expect to see it here with the field definition:

  'type'        => Types::string(),
  'description' => __( 'Content of the comment. This field is equivalent to WP_Comment->comment_content and the value matching the `comment_content` column in SQL.', 'wp-graphql' ),
'args' => [
  'format' => [
     'type' => // the format enum
     'description' => // the description of the enum 
  ]
]

Copy link
Member Author

Choose a reason for hiding this comment

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

Corrected. I used Types::post_object_field_format_enum() as the type

@@ -57,7 +57,7 @@ public function testPluginQuery() {
'id' => $global_id,
'name' => 'Hello Dolly',
'pluginUri' => 'http://wordpress.org/plugins/hello-dolly/',
'version' => '1.6',
'version' => '1.7',
Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to change the assertion we're making here so this doesn't cause failures when we test on different versions of WordPress core that ship with different versions of this plugin. I'll create another issue to address this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll write a helper function in the test

@@ -0,0 +1,102 @@
<?php
Copy link
Collaborator

Choose a reason for hiding this comment

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

@kidunot89 can you run:

rm -rf vendor
composer install --no-dev

Then push again. We don't want to version the dev dependencies that are used for Unit tests, etc.

Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll do it asap

$mutation_name = 'CreateComment';
self::$mutation = Relay::mutationWithClientMutationId([
'name' => $mutation_name,
'description' => __('Create comment objects', 'wp-graphql'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a huge deal but we mostly try and follow WordPress core code standards in terms of spacing, etc.

If you're using PHPStorm you can easily set the project to use the WordPress code style then reformat the files.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using VSCode but I can use Wordpress spacing from now on and make changes to my code. I kinda hate the spacing because is make reading it from a mobile device kinda unbearable.

@jasonbahl
Copy link
Collaborator

@kidunot89 it looks like something is causing the test environment to not get setup properly when Travis-CI runs the tests.

I'll pull this locally and check things out and see if we can get it straight.

@jasonbahl jasonbahl closed this Jul 20, 2018
@jasonbahl jasonbahl reopened this Jul 20, 2018
@jasonbahl jasonbahl merged commit fde0424 into wp-graphql:develop Jul 20, 2018
@jasonbahl
Copy link
Collaborator

closes #8

@jasonbahl jasonbahl mentioned this pull request Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants