Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Update discussion meta #525

Merged
merged 6 commits into from
Nov 9, 2018
Merged

Update discussion meta #525

merged 6 commits into from
Nov 9, 2018

Conversation

WPprodigy
Copy link
Contributor

@WPprodigy WPprodigy commented Nov 9, 2018

Solves the issues raised in #238. Shows the full comment count and doesn't purposely exclude the current user's avatar.

Also solves what I believe was a bug introduced here: https://github.com/WordPress/twentynineteen/pull/367/files#diff-1cc0a2eb5e0be1a17d62b9ce5d17cf41R169

This is actually a big improvement from a scale standpoint. Running an unbounded query to get all the comments for the sole purpose of getting a count of unique commenters isn't worth it.

Some points that may need discussion:

  1. I chose 20 comments in the query fairly randomly. We definitely don't want it to be unbounded, but welcome to any ideas / improvements. The goal is just a maximum of 6 unique authors.
  2. Could use either the “%d responses” or “%d Comments” grammar. I went with the latter as it's purpose was for cases where there wasn't any $commenter data (though I'm fairly sure this was bugged and would have never worked as intended)

1) Don’t need to exclude the current user anymore

2) Use get_comments_number() instead of an unbounded query and set the query to just get 20 comments.

3) Don’t need the number of commenters anymore either.
The second elseif would never be used. $discussion->responses === get_comments_number().

Could use either “%d responses” or “%d Comments” grammer here. I don’t really have a preference.
Another call to get_comments_number() is repetitive here.

Also removed the triple equals check because `get_comments_number()` apparently returns string or int: https://developer.wordpress.org/reference/functions/get_comments_number/
Minor change, just seemed odd to use the authors for this.
@kjellr kjellr requested a review from allancole November 9, 2018 18:36
Copy link
Collaborator

@allancole allancole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose 20 comments in the query fairly randomly. We definitely don't want it to be unbounded, but welcome to any ideas / improvements. The goal is just a maximum of 6 unique authors.

Yeah, I think 20 is good enough boundary for this. It’s really just a visual cue to encourage commenting and doesn’t really need to be reflective of the actual comment order.

Could use either the “%d responses” or “%d Comments” grammar. I went with the latter as it's purpose was for cases where there wasn't any $commenter data (though I'm fairly sure this was bugged and would have never worked as intended)

Yeah, I think %d Comments works best here. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants