#44033 closed enhancement (fixed)
Get Avatar Comment Types should be a Function Not Just a Filter
Reported by: | dshanske | Owned by: | pento |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch has-unit-tests needs-refresh needs-testing |
Focuses: | Cc: |
Description
Pretty much what it says.
I envision, is_avatar_comment_type, that takes WP_Comment, or a comment_ID and returns true or false.
Right now, if I want to use this filter in the code I use to bypass Gravatar, I have call the filter myself. I don't think it is a good idea to call filters multiple times if you can help it.
Attachments (3)
Change History (23)
#3
@
7 years ago
Can you give me some instructions on how to proceed? :)
I was looking at https://codex.wordpress.org/User:HEngel/How_To_Become_A_WordPress_Developer but i don't know if it's a good direction.
Also where can i find the documentation for the Comments component?
#4
@
7 years ago
That broader question may do better to ask in the Slack chat as you get a broader opinion. There is no specific documentation by component, though I like the developer resources on WordPress.org
For the ticket, I would create a function that calls the filter then replace all usage of the filter in core with the function.
This ticket was mentioned in Slack in #core by lucas05. View the logs.
7 years ago
#6
@
7 years ago
- Keywords has-patch added; good-first-bug removed
- Milestone changed from Awaiting Review to 4.9.7
I went to the simpler checking of comment type and just moved the filter to a function.
#7
@
7 years ago
- Keywords has-unit-tests added
The patch in 44033.2.diff:
- Adds a strict in array check.
- Adds unit tests for
is_avatar_comment_type()
undertests/phpunit/tests/comment/isAvatarCommentType.php
.
I could not find any explicit tests for the get_avatar_data()
function.
But I will try to add a test under tests/phpunit/tests/avatar.php
.
#8
@
7 years ago
The patch 44033.3.diff additionally:
- Adjusts the
@return
description for theis_avatar_comment_type()
function. - Adds the following tests cases for the
get_avatar_data()
function:Tests_Avatar::test_get_avatar_data_should_return_gravatar_url_when_input_avatar_comment_type()
Tests_Avatar::test_get_avatar_data_should_return_invalid_url_when_input_not_avatar_comment_type()
#10
@
6 years ago
- Milestone changed from 4.9.7 to 4.9.8
4.9.7 has been released, moving to next milestone.
This ticket was mentioned in Slack in #core by joshuawold. View the logs.
6 years ago
#17
@
6 years ago
- Milestone changed from 5.0.3 to 5.1
Hello,
5.0.3 is going to be released in a couple of weeks.
It doesn't appear this ticket can be handled in the next couple of weeks (still needs some tests). Let's address it in 5.1 which is coming in February. Feel free to ask for changing the milestone if you think this issue can be quickly resolved.
Cheers,
Jb
Hi,
Can I work on this? It will be my first bug :)
Thank you!
Luca