Address some of things found in #633 #634
Merged
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 some of the things found in #633
Proposed changes:
wp_update_comment()
doesn't actual return a comment ID.Interactions::update_comment()
takes this into account and returns the$commentdata
array, but only when the update was successful.Interactions::update_comment()
either returnsfalse
or'invalid'
(just like before) or whatever is returned bywp_update_comment()
(which can be an error, or0
, or evenfalse
). Actually, in this case, the function behaves just like it did before.\get_comment( $state )
with something that I think makes a bit more sense (as mentioned,$state
isn't actually a comment ID).Other information:
Testing instructions:
The way I tested this, is I created a callback in a separate mu-plugin like so:
Thing is, and this might be another bug but I left it untouched for now, I have no clue what the second param really is.
Prior to this PR,
$reaction
would always benull
or the comment with ID1
(but, as mentioned, the1
returned bywp_update_comment()
isn't actually a comment ID).With this PR,
$reaction
is either a comment object ornull
. And$state
basically the result of thewp_update_comment()
call, kind of like before.Either way, this short callback addresses #633. So if this PR were merged, site admins or developers would be able to much more easily force re-approval of updated comments.