Repository navigation
Fill in defaults for registered comment types - #3982
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #
Proposed changes:
register_comment_type()now fills in defaults for every key the plugin reads (label,singular,type,collection,activity_types,excerpt,count_single,count_plural, …). Before, it stored the arguments as given, so a type registered by another plugin with only some of them causedUndefined array keywarnings, e.g. inComment::get_comment_type_by_activity_type()and the reactions REST endpoint.like,quoteandrepost. Those three stay, because the registered types are only known afterinit.Other information:
I found this through a local demo mu-plugin that registers
mention,bookmarkandpaperwith only a label and the count strings. With it, ten tests failed locally while CI stayed green.Testing instructions:
vendor/bin/phpunit --filter 'Test_Functions_Comment|Test_Comment|Test_Post_Controller|Test_Jetpack'.\Activitypub\register_comment_type( 'bookmark', array( 'label' => 'Bookmarks' ) );in a mu-plugin, and open a post with reactions: no PHP warnings.Changelog entry
Changelog Entry Details
Significance
Type
Message