Opened 5 months ago
Last modified 13 hours ago
#64638 new enhancement
Register emoji reactions comment meta for Notes
| Reported by: | adamsilverstein | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Cc: | Focuses: |
Description (last modified by )
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 (10)
This ticket was mentioned in PR #10930 on WordPress/wordpress-develop by @adamsilverstein.
5 months ago
#1
- Keywords has-unit-tests added
#2
@
5 months 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:
5 months 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.
#5
@
5 months ago
- Milestone 7.0 → 7.1
WP 7.0 pre-beta1 Triage:
Unfortunately this enhancement didn't make it before beta 1 code freeze. Thus, let's move it to milestone 7.1.
@adamsilverstein commented on PR #10930:
8 weeks ago
#6
Thanks for the review @t-hamano! I've pushed f3b5af251b addressing the feedback:
@sincebumps: Updated all PR-introduced@since 7.0.0to@since 7.1.0(incomment.php,link-template.php, andclass-wp-rest-comments-controller.php).WP_Comment_Query: Updated the existing exclusion block to iterate overwp_get_internal_comment_types()so bothnoteandreactionare excluded by default unless explicitly requested.get_lastcommentmodified(): Added acomment_type NOT IN (…)clause built fromwp_get_internal_comment_types()to all three timezone branches so internal comment types no longer affect the last modified date.- Reaction icon list: Moved
wp_get_note_reaction_emojis()intoWP_REST_Comments_Controller::get_note_reaction_emojis()as aprotected staticmethod, per your suggestion to avoid a public global while the icon-library plans are still being worked out. wp_internal_comment_typesfilter: Removed — agreed it's not needed for an internal helper.wp_list_plucksimplification at line 360: Applied. The'note' === $comment->comment_typecheck inside the loop was redundant since$request['type']is already gated to'note'above andWP_Comment_Queryconstrains the result set, so it's gone too.
Locally, the relevant test suites (Tests_Comment_*, Tests_REST_Comments, Tests_Avatar) all pass: OK (165 tests, 476 assertions).
#7
@
7 weeks ago
Removing trunk version as this is not going to be shipped with WP 7.0 but in the next releases.
#8
@
7 weeks ago
- Description modified (diff)
- Summary Editor: Register emoji reactions comment meta for Notes → Register emoji reactions comment meta for Notes
- Version trunk
Since this is an enhancement, there's no first version of WordPress this can be reproduced in. Removing trunk version.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
## 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
---