weixin_39808953
weixin_39808953
2021-01-10 10:42

Comments Endpoints

Still a Work In Progress, but opening to show progress and encourage any feedback as this progresses.

I took the (controversial) decision to use /comments as the canonical place for comments. I was then thinking /posts/1/comments would 301 to /comments?post_id=1 or somehting along those lines. I think it's nicer to keep the comments at their own top level so they are independant of posts apart from the embedding we are doing elsewhere already.

该提问来源于开源项目:WP-API/WP-API

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

12条回答

  • weixin_39619451 weixin_39619451 4月前

    -API/amigos #reviewmerge

    Test coverage (per the PHPUnit Coverage report) is currently at the following: get_items: 94.12% get_item: 92.86% create_item: 80.95% update_item: 85.19% delete_item: 69.23%

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 4月前
    • Added support for more GET /comments endpoint query parameters
    • Filtered the GET /comments endpoint query parameters based on permissions.
    • Added additional test coverage for the delete_item method, so that is now: 84.62%
    • Audited DocBlocks.

    I am happy with where this is at.

    点赞 评论 复制链接分享
  • weixin_39689377 weixin_39689377 4月前

    Thanks , looking pretty good. Just needs a little bit of cleanup.

    点赞 评论 复制链接分享
  • weixin_39520988 weixin_39520988 4月前

    and how to enable this?

    like this? add_filter('rest_allow_anonymous_comments',false);

    点赞 评论 复制链接分享
  • weixin_39778218 weixin_39778218 4月前

    +1 how enable guest comments now?

    点赞 评论 复制链接分享
  • weixin_39520988 weixin_39520988 4月前

    add_filter( 'rest_allow_anonymous_comments', '__return_true' );

    点赞 评论 复制链接分享
  • weixin_39689377 weixin_39689377 4月前

    I took the (controversial) decision to use /comments as the canonical place for comments.

    Dig it!

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 4月前

    This looks great. It looks like this needs more work for test coverage.
    What else do you see is needed here before it would be ready to merge?

    点赞 评论 复制链接分享
  • weixin_39808953 weixin_39808953 4月前

    apologies, haven't had any time to spend on this over the holidays, you are more than welcome to carry on where I left off. If you do, just assign this PR to you so I don't continue!

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 4月前

    Thank you. I will pick this up.

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 4月前

    This is still missing the update_comment endpoint, I will wrap that up this week.

    点赞 评论 复制链接分享
  • weixin_39619451 weixin_39619451 4月前

    In the future, I would like to use wp_new_comment() instead of wp_insert_comment(). Related core ticket: https://core.trac.wordpress.org/ticket/14601

    Also wp_update_comment() doesn't update the comment_post_ID. Related core ticket: https://core.trac.wordpress.org/ticket/30946

    点赞 评论 复制链接分享

相关推荐