Editor: Register emoji reactions comment meta for Notes#10930
Editor: Register emoji reactions comment meta for Notes#10930adamsilverstein wants to merge 4 commits intoWordPress:trunkfrom
Conversation
Add `_wp_note_reactions` comment meta registration to `wp_create_initial_comment_meta()`. This meta stores emoji reaction data for the block editor's collaborative Notes feature, complementing the existing `_wp_note_status` meta. The meta is registered as an object type with a REST schema that describes the data model: each emoji key maps to an array of objects containing `userId` (integer) and `date` (date-time string or null). See WordPress/gutenberg#75148 Props adamsilverstein. Fixes #.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| } | ||
| } | ||
| }, | ||
| "authentication": [], |
There was a problem hiding this comment.
Why did this changed? Stale from a previous commit?
There was a problem hiding this comment.
yes, I ran the test_build_wp_api_client_fixtures test locally to regenerate fixtures and this was the result. I wrote that test so I'm confident this is correct, but happy to add in a separate PR since its unrelated to the current changes. ideally we should have a check similar to package lock that checks if running the regeneration changes the fixture and reject the merge if so.
| "properties": [], | ||
| "properties": { | ||
| "wp_pattern_sync_status": { | ||
| "type": "string", | ||
| "title": "", | ||
| "description": "", | ||
| "default": "", | ||
| "enum": [ | ||
| "partial", | ||
| "unsynced" | ||
| ] | ||
| } | ||
| }, |
There was a problem hiding this comment.
I guess this fixture wasn't updated correctly for a previous commit that introduced this?
There was a problem hiding this comment.
correct. you can verify by running the test_build_wp_api_client_fixtures test locally to regenerate fixtures. the file should match what you see in this PR. (I used WP_TESTS_DIR=/Users/adamsilverstein/repositories/wordpress-develop/tests/phpunit/ DB_PASSWORD=**** php ./vendor/bin/phpunit --verbose -c ./phpunit.xml.dist --filter=test_build_wp_api_client_fixture)
| 'show_in_rest' => array( | ||
| 'schema' => array( | ||
| 'type' => 'object', | ||
| 'additionalProperties' => array( |
There was a problem hiding this comment.
Can patternProperties be used instead? This could add constraints for what emoji are allowed as keys.
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Summary
Register the
_wp_note_reactionscomment meta inwp_create_initial_comment_meta(), alongside the existing_wp_note_statusmeta. This meta stores emoji reaction data for the block editor's collaborative Notes feature.Data Model
Each emoji key (e.g.,
"👍","❤️") maps to an array of reaction objects:{ "👍": [ { "userId": 1, "date": "2025-01-15T10:30:00" }, { "userId": 2, "date": "2025-01-15T11:00:00" } ], "❤️": [ { "userId": 1, "date": "2025-01-15T10:35:00" } ] }REST Schema
objecttrue[](empty array)additionalProperties: Each property is an array of objects with:userId(integer) — The reacting user's IDdate(string|null, date-time format) — When the reaction was addedAuth
Uses the same
edit_commentcapability check as_wp_note_status.References