Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@rachelbaker
Copy link
Member

@rachelbaker rachelbaker commented Dec 21, 2015

This PR allows the comment_author_IP value to be set when creating a comment. While working on this, I remembered why we don't handle this field... while with wp_insert_comment() you can as of WP 4.3 set the comment_author_IP BUT you cannot modify this field in wp_update_comment().

Questions:

  1. Do we allow this property to be set when creating a Comment, BUT not allow it to be edited? How should that be reflected in the schema?
  2. Should we add a filter for the default comment_author_IP value (currently 127.0.0.1)?

UPDATE:

This PR has been refreshed and as of WP 4.5 the comment_author_ip property can be modified. View details on the refresh: #1880 (comment)

Fixes #1788

@rachelbaker
Copy link
Member Author

@WP-API/amigos thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

What if we added ip_address as a new format in our schema, so validation could happen much earlier (and in batch)?

@rachelbaker
Copy link
Member Author

Related core ticket: https://core.trac.wordpress.org/ticket/35276

@danielbachhuber
Copy link
Member

Something I've been thinking about recently with regards to whether or not fields should be editable: import / export. If someone were to build a import / export workflow based on the REST API, which seems totally reasonable to me, it seems like a reasonable assumption they should be able to update most any fields for resources.

@rachelbaker
Copy link
Member Author

Something I've been thinking about recently with regards to whether or not fields should be editable: import / export. If someone were to build a import / export workflow based on the REST API, which seems totally reasonable to me, it seems like a reasonable assumption they should be able to update most any fields for resources.

@danielbachhuber, can you please add those thoughts to https://core.trac.wordpress.org/ticket/35276? Additional supporting opinions will help.

@rachelbaker
Copy link
Member Author

In WP 4.5 this will no longer be blocked on core. I will pick this back up after release.

@danielbachhuber danielbachhuber modified the milestones: 2.0 Beta 13, 2.0 Mar 14, 2016
@caglaroner
Copy link

caglaroner commented Apr 20, 2016

@rachelbaker & @danielbachhuber Great job on the WP-API and thank you very much for all your contributions.

Our team is currently blocked on this issue (more specifically the post comment part) and we would hate to branch out and patch it on our end.

Is there any timeline or progress on this issue?

@codecov-io
Copy link

Current coverage is 93.83%

Merging #1880 into develop will decrease coverage by -0.73%

@@            develop   #1880   diff @@
=======================================
  Files            11      13     +2   
  Lines          3627    3766   +139   
  Methods         171     183    +12   
  Branches          0       0          
=======================================
+ Hits           3430    3534   +104   
- Misses          197     232    +35   
  Partials          0       0          
  1. 9 files (not in diff) in lib/endpoints were modified. more
    • Misses +7
    • Hits -96
  2. 2 files (not in diff) in lib/endpoints were created. more
  3. File ...ments-controller.php was modified. more
    • Misses +9
    • Partials 0
    • Hits 0
  4. File plugin.php (not in diff) was modified. more
    • Misses +3
    • Partials 0
    • Hits -48

Powered by Codecov. Last updated by 40360af...278c407

@codecov-io
Copy link

codecov-io commented May 8, 2016

Current coverage is 94.54%

Merging #1880 into develop will decrease coverage by -<.01%

@@            develop      #1880   diff @@
==========================================
  Files            11         11          
  Lines          3627       3642    +15   
  Methods         171        171          
  Messages        171          0   -171   
  Branches          0          0          
==========================================
+ Hits           3430       3443    +13   
- Misses          197        199     +2   
  Partials          0          0          
  1. File ...ments-controller.php was modified. more
    • Misses +1
    • Partials 0
    • Hits -1

Powered by Codecov. Last updated by 40360af...d051e65

@rachelbaker
Copy link
Member Author

@WP-API/amigos This PR has been refreshed and is ready for review.

  • Handles setting and updating the author_ip property on comment create & update
  • Uses 127.0.0.1 as the default author_ip value in the schema
  • Adds a new ipv4 string format (which matches the following example on the JSON Schema site: http://json-schema.org/example2.html)
  • Adds the IP validation utility function rest_is_ip_address() which ideally I would like to get into WP core.

@rachelbaker rachelbaker merged commit 8edf3fc into develop Jun 17, 2016
@rachelbaker rachelbaker deleted the 1788-comment-author-IP branch June 17, 2016 14:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants