Opened 3 weeks ago
Last modified 2 weeks ago
#64638 new enhancement
Editor: Register emoji reactions comment meta for Notes
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.1 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Editor | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Focuses: | Cc: |
Description
Summary
Register the _wp_note_reactions comment meta in wp_create_initial_comment_meta(), alongside the existing _wp_note_status meta. 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
- Type:
object - Single:
true - Default:
[](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 added
Auth
Uses the same edit_comment capability check as _wp_note_status.
Changes
- Updated
wp_create_initial_comment_meta()insrc/wp-includes/comment.phpto register_wp_note_reactionsmeta. - Updated docblock with
@since 7.0.0tag. - Regenerated
tests/qunit/fixtures/wp-api-generated.js.
References
Change History (5)
This ticket was mentioned in PR #10930 on WordPress/wordpress-develop by @adamsilverstein.
3 weeks ago
#1
- Keywords has-unit-tests added
#2
@
3 weeks ago
Why store reactions like this and not as a separate comment type? Makes it more flexible and potentially useful for regular comments as well. See also https://wordpress.org/plugins/react/
@adamsilverstein commented on PR #10930:
2 weeks ago
#4
I have updated this backport PR to apply the custom comment type approach for storage used in https://github.com/WordPress/gutenberg/pull/75549 which replaces the meta based approach in https://github.com/WordPress/gutenberg/issues/75144.
## 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 added### Auth
Uses the same
edit_commentcapability check as_wp_note_status.## References
---