-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Incorporating foundation of "Notes" feature #10280
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
Closed
+600
−20
Closed
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
e08eea2
Update comment REST API
t-hamano c00b9e1
Add post type support
t-hamano c1aebc0
Register metadata
t-hamano 495504c
Update avatar comment type
t-hamano f5207cf
Allow duplicate notes for resolution purposes
t-hamano 954f534
Exclude notes from admin comments query
t-hamano 7d1e549
Exclude note type comment from comment count query
t-hamano 3e4347b
Extend post_type_supports function to check sub-features
t-hamano 7276884
Remove unnecessary check
t-hamano f74effd
Change how sub-features are checked
t-hamano 13defce
Fix WP_Test_REST_Comments_Controller Unit test
t-hamano 3cf787a
Revert changes to the post_type_supports function
t-hamano b351ddb
Add unit test for notes
t-hamano ce0f128
Minor refactoring and fix lint error
t-hamano df8cb5d
Regenerate API fixtures
t-hamano 4833d19
Try to fix JS API Tests
t-hamano 35375c8
"block comments" to "notes"
t-hamano 4ab0abf
Try to fix JS API Tests (Take 2)
t-hamano b0bcc8c
Revert changes for JS API Tests
t-hamano 891d9d2
Add @ticket docblock
t-hamano 6caa20b
Revert unnecessary changes for post_type_support
t-hamano 1f3b1d8
Move "where" clauses into WP_Comments_List_Table
t-hamano 10e1023
Revert wp-api.js and wp-api-generated.js to trunk versions
t-hamano ae2ba63
Don't change 'type' schema
t-hamano 6ada59c
check_post_type_supports_notes: invert default return value
t-hamano 571ede1
entirely revert wp-api-generated.js
t-hamano c0d81db
Remove unnecessary textdomain
t-hamano a208f84
Delete unnecessary empty line
t-hamano a21c51f
Simplify note support check
t-hamano 992a3bd
Removed redundant empty check
t-hamano f0ee469
Define default value for comment type as a schema
t-hamano 48cb687
Updated function name for registering comment meta
t-hamano 278d274
Remove redundant check from comment meta registration
t-hamano a43a2b0
Make filterable
t-hamano a643878
Don't count Note comments in the dashboard UI
t-hamano 6eb536a
Merge branch 'trunk' into 64096-notes-backport
t-hamano 4edfc8d
Update PHPDoc comment
t-hamano 2ad2332
Merge branch 'trunk' into 64096-notes-backport
adamsilverstein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,6 +417,7 @@ function get_comment_count( $post_id = 0 ) { | |
'count' => true, | ||
'update_comment_meta_cache' => false, | ||
'orderby' => 'none', | ||
'type__not_in' => array( 'note' ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
); | ||
if ( $post_id > 0 ) { | ||
$args['post_id'] = $post_id; | ||
|
@@ -714,6 +715,11 @@ function wp_allow_comment( $commentdata, $wp_error = false ) { | |
|
||
$dupe_id = $wpdb->get_var( $dupe ); | ||
|
||
// Allow duplicate notes for resolution purposes. | ||
if ( isset( $commentdata['comment_type'] ) && 'note' === $commentdata['comment_type'] ) { | ||
$dupe_id = false; | ||
} | ||
|
||
/** | ||
* Filters the ID, if any, of the duplicate comment found when creating a new comment. | ||
* | ||
|
@@ -4103,3 +4109,27 @@ function _wp_check_for_scheduled_update_comment_type() { | |
wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'wp_update_comment_type_batch' ); | ||
} | ||
} | ||
|
||
/** | ||
* Register initial note status meta. | ||
* | ||
* @since 6.9.0 | ||
*/ | ||
function wp_create_initial_comment_meta() { | ||
register_meta( | ||
'comment', | ||
'_wp_note_status', | ||
array( | ||
'type' => 'string', | ||
'description' => __( 'Note resolution status' ), | ||
'single' => true, | ||
'show_in_rest' => array( | ||
'schema' => array( | ||
'type' => 'string', | ||
'enum' => array( 'resolved', 'reopen' ), | ||
), | ||
), | ||
) | ||
); | ||
} | ||
add_action( 'init', 'wp_create_initial_comment_meta' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's another PR for
get_pending_comments_num
changes - #9869.Just noting for props.
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.
Not a fan of hardcoding comment types. Long term we should think about using a filterable list of comment types to exclude or using (an improved)
WP_Comment_Query
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.
100%. I think a long-term solution is to provide proper support for custom comment types, so we can avoid hardcoded patches like we've introduced with the current implementation.