[wp-trac] [WordPress Trac] #38342: Quick Draft: Leverage REST API endpoints

WordPress Trac noreply at wordpress.org
Tue Nov 22 20:49:48 UTC 2016


#38342: Quick Draft: Leverage REST API endpoints
---------------------------------+-----------------------------------
 Reporter:  adamsilverstein      |       Owner:  joehoyle
     Type:  enhancement          |      Status:  assigned
 Priority:  normal               |   Milestone:  Future Release
Component:  Administration       |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  has-patch 4.8-early  |     Focuses:  javascript, rest-api
---------------------------------+-----------------------------------

Comment (by joehoyle):

 > wp_dashboard_recent_drafts() should be deprecated, and the docs for
 dashboard_recent_drafts_query_args moved to
 rest_filter_quick_draft_query().

 Added in 38342.12.diff - however I've not depracated a function before!

 > There's no fallback for the post title being empty,

 Added in 38342.12.diff

 > Are the 'object' === typeof attributes.content and 'object' === typeof
 attributes.title checks necessary? These attributes should always be
 objects.

 I changed this in 38342.12.diff to be a fair bit simpler. We just take the
 value in the `render()` method now - you are right, those fields always do
 exist.

 > Generally speaking, the JavaScript feel overly verbose, I found it
 tricky to keep track of code paths in my head, which shouldn't be
 happening for such a simple feature....

 I tried to make things a bit simpler in the latest patch by not declaring
 our own models and collections, instead using using
 `wp.api.collections.Posts` etc which I think is better for example
 purposes too.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38342#comment:61>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list