Opened 10 years ago
Closed 10 years ago
#28147 closed defect (bug) (fixed)
No ratings string never used?
Reported by: | pavelevap | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Themes | Keywords: | good-first-bug has-patch dev-feedback |
Focuses: | Cc: |
Description
String "No ratings." is probably never used.
https://core.trac.wordpress.org/browser/tags/3.9/src/wp-admin/theme-install.php#L236
There is following condition:
<# if ( data.num_ratings ) { #>
But data.num_ratings is the whole string "(based on %s rating)" and never empty or null. When there is no rating, data.num_ratings will be "(based on 0 rating)". And this is not ideal...
I am not sure which variable contains real number of ratings to patch this issue.
Attachments (6)
Change History (14)
#3
@
10 years ago
- Keywords has-patch added; needs-patch removed
There's a simpler solution. I've added patch 28147.diff that fixes this issue without any major changes.
#4
@
10 years ago
Actually, i think there's an even easier way, which is what I think the original developer intended.
data.num_ratings
is always a string, which is the obvious problem. jorbin mentioned amending some code to return the raw count, this actually exists in data.rating
(as an int), this is what should be used.
28147.2.diff fixes this.
#5
@
10 years ago
- Keywords dev-feedback added
This actually got me thinking. Should the star's actually show if there's no rating? They are always going to blank, and it doesn't really add anything to the page. In fact, in my opinion, it looks negative as you could easily interpret the theme as rubbish purely because there's no rating.
28147.3.diff hides the stars and says 'This theme hasn't been rated' if there's no rating, and does the default if there is a rating (stars, then '(based on X ratings'). See the screenshots.
Anyone disagree or have a better idea?
#6
@
10 years ago
28147.3.diff looks good to me. (A small note, we don't generally escape apostrophes with slashes like that, the preferred way is to switch to double quotes, see the coding standards.)
I'd suggest changing the string to "This theme has not been rated yet".
#7
@
10 years ago
The refreshed 28147.4.diff patch does not use contracted english grammar and is created from the repository root instead of inside src
.
wp_ajax_query_themes will need to be modified to include the raw count of ratings and we will need to update the check to look for that.