WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#41055 closed enhancement (fixed)

WP-API JS Client: Improve support for meta

Reported by: adamsilverstein Owned by: adamsilverstein
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7
Component: General Keywords: has-patch has-unit-tests commit
Focuses: javascript, rest-api Cc:
PR Number:

Description

The wp.api JavaScript client support for meta needs some attention:

  • Meta helper isn't available for comments, terms and users
  • Meta pieces haven't been updated for the new-style meta model

The getMeta helper should work correctly for all object types that support meta. We should also consider adding a matching setMeta helper.

See https://github.com/WP-API/client-js/issues/168.

Attachments (4)

41055.diff (1.1 KB) - added by adamsilverstein 2 years ago.
41055.2.diff (6.0 KB) - added by adamsilverstein 2 years ago.
41055.3.diff (6.1 KB) - added by adamsilverstein 2 years ago.
41055.4.diff (10.4 KB) - added by adamsilverstein 2 years ago.

Download all attachments as: .zip

Change History (12)

#1 @adamsilverstein
2 years ago

  • Keywords has-patch needs-unit-tests added; needs-patch removed

In 41055.diff :

Improve support for and detection of meta. wp.api.models.Post, User, Comment and other models supporting meta now include helpers for getMeta() and setMeta().

Some unit tests verifying at a minimum that the helpers are attached would be helpful.

#2 @adamsilverstein
2 years ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


2 years ago

#4 @adamsilverstein
2 years ago

  • Keywords has-unit-tests commit added; needs-unit-tests removed

In 41055.2.diff:
REST API JS Client - improve support for meta.

  • Add getMeta, getMetas, setMeta, setMetas helpers for models that contain meta.
  • Add tests for new helpers.
  • Include meta data in fixture generation and fixture file driving tests.

This ticket was mentioned in Slack in #core-restapi by adamsilverstein. View the logs.


2 years ago

#6 @adamsilverstein
2 years ago

In 41055.4.diff:

  • Add tests: test meta support for Posts, Comments, Tags and Users.
  • Add meta for these types to test_build_wp_api_client_fixtures
  • Update generated fixture data.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


2 years ago

#8 @adamsilverstein
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41678:

WP-API JS Client: Improve support for meta.

  • Add/fix getMeta, getMetas, setMeta and setMetas helpers for models that support meta.
  • Add tests for new helpers, verify meta support for Posts, Comments, Tags and Users.
  • Include meta data in fixture generation and fixture file driving tests.

Fixes #41055.

Note: See TracTickets for help on using tickets.