Make WordPress Core

Opened 3 weeks ago

Last modified 2 weeks ago

#64638 new enhancement

Editor: Register emoji reactions comment meta for Notes

Reported by: adamsilverstein's profile adamsilverstein 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 ID
    • date (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() in src/wp-includes/comment.php to register _wp_note_reactions meta.
  • Updated docblock with @since 7.0.0 tag.
  • 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

## 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 ID
    • date (string|null, date-time format) — When the reaction was added

### Auth

Uses the same edit_comment capability check as _wp_note_status.

## References

---

#2 @swissspidy
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/

#3 @wildworks
3 weeks ago

  • Keywords gutenberg-merge added

@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.

#5 @audrasjb
2 weeks ago

  • Milestone changed from 7.0 to 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.

Note: See TracTickets for help on using tickets.