-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Site Editor Pages: add "notes count" field #73609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| notes.forEach( ( note ) => { | ||
| const postId = note.post; | ||
| counts[ postId ] = ( counts[ postId ] || 0 ) + 1; | ||
| } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This displays all the notes, regardless of status or whether the note is a top-level or a response. It mimics what we do in "wp-admin > Posts" where we also list all the comments (not only the top-level ones):
(the post has 3 comments, 2 of them top-level, another as a response to an existing comment)
| thumbnail?: string; | ||
| comments?: string; | ||
| editor?: boolean; | ||
| editor?: boolean | [ EditorSupport ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support for editor.notes landed a month ago at WordPress/wordpress-develop@c62fe7e#diff-ef9c5475561d459917dac57d21e08a6dfeb36f8b1c44b978d3696aec8b97c405
| if ( processedRecords ) { | ||
| return processedRecords.map( ( record ) => ( { | ||
| ...record, | ||
| notesCount: notesCount[ record.id ] ?? 0, | ||
| } ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works and it's fine. One thing I'd like to investigate further is: how do we automatically "register data for an entity"? This is for a separate follow-up. We already have registerEntityField, and there's established mechanisms on WordPress (post meta).
|
Size Change: +282 B (+0.01%) Total Size: 2.55 MB
ℹ️ View Unchanged
|
Notes field
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to include filter support, so the user can filter the pages with notes?
| return counts; | ||
| }, [ notes ] ); | ||
|
|
||
| return { notesCount, isResolving }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using isResolving, should we use it somewhere? If not do we need to return it for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this 75ef57b
|
We have some bugs we could press the notes column add a filter, filter by value but it does not work. If we don't support filters we should hide the option for now. Another issue is if we sort by notes data disappears and becomes empty. |
|
@jorgefilipecosta I've disabled filter and sorting at ff12fcc For these to work, we'd need to improve the Post endpoint, so we can sort by comments (notes). Curiously, this does work in wp-admin: Screen.Recording.2025-11-27.at.16.58.20.movIt's supported by the table and the query. But it's not supported at the endpoint level. We'd need to add support for notes (not comments), if we wanted sort. Same for filtering. |
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested well for me, thank you for the fixes @oandregal 👍
Closes #73606
What?
Adds a new note field in the Site Editor > Pages.
Why?
See #73606
How?
notesCountfields.editor.notes.Testing Instructions
Notesfield (via cog/view config, or via right-click in the column header).