Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#35519 closed defect (bug) (fixed)

Dashboard At a Glance: comment counter isn't updated if to approve comment

Reported by: antonrinas Owned by: SergeyBiryukov
Priority: normal Milestone: 4.6
Component: Comments Version: 4.1
Severity: minor Keywords: has-screenshots has-patch commit
Cc: Focuses: ui

Description

STEPS TO REPRODUCE:
Log in as administrator, create new post, log out,
log in as subscriber user, create new comment for created post, log out,
log in as administrator, approve subscriber's comment on Dashboard page in "Activity" group box using hidden menu item "Approve".
EXPECTED RESULT: subscriber's comment became approved, link "View", total comments counter is updated.
ACTUAL RESULT: subscriber's comment became approved, there is no total comments counter (see attachment).

Attachments (3)

Dashboard2.jpg​ (75.8 KB ) - added by antonrinas 11 years ago.
Dashboard screenshot
35519.patch​ (631 bytes ) - added by afercia 11 years ago.
35519.2.patch​ (2.3 KB ) - added by rachelbaker 10 years ago.
Remove the conditional check on wp_count_comments

Download all attachments as: .zip

Change History (13)

@antonrinas
11 years ago

Dashboard screenshot

#1 follow-up: @antonrinas
11 years ago

  • Severity normal → minor

#2 in reply to: ↑ 1 @Latz
11 years ago

Replying to antonrinas:
Tried to reproduce the error. System worked as expected, no problems. Do you have any plugins activated? If so, can you retry with a clean installation?

@afercia
11 years ago

#3 @afercia
11 years ago

  • Focuses ui added
  • Keywords has-patch has-screenshots added

This happens only when there are 0 approved comments. The comment counts in wp_dashboard_right_now() should probably be displayed also in the rare, initial, condition when there are 0 approved comments and only pending comments.

Fixing this initial condition, then the AJAX count update works fine, as far as I see.

#4 follow-up: @rachelbaker
11 years ago

  • Keywords needs-refresh added
  • Milestone Awaiting Review → Future Release
  • Version 4.4.1 → 4.1

@afercia Looks like your approach in 35519.patch​ goes against [29785], so the "fix" here would have to be done with JS.
See #26738

Last edited 11 years ago by SergeyBiryukov (previous) (diff)

#5 @afercia
11 years ago

@rachelbaker if I remember correctly, the displayed number will be always the one of approved comments. We just need to print out the element to update via JS even when there are "0" comments approved.

#6 @rachelbaker
11 years ago

  • Milestone Future Release → 4.6

@rachelbaker
10 years ago

Remove the conditional check on wp_count_comments

#7 @rachelbaker
10 years ago

  • Keywords needs-refresh removed

@afercia It looks to me as though we should just remove the conditional check if ( $num_comm && $num_comm->approved ), see 35519.2.patch​. Any reason you would prefer your approach?

#8 in reply to: ↑ 4 @rachelbaker
10 years ago

BTW: I was incorrect here:

@afercia Looks like your approach in 35519.patch​ goes against [29785], so the "fix" here would have to be done with JS.
See #26738

because you were only adding to the conditional, you didn't change the displayed property. Sorry about that.

#9 @rachelbaker
10 years ago

  • Keywords commit added

After a Slack discussion with @afercia and sleeping on it, I believe 35519.patch​ is the better approach because it provides sanity checks for the filterable result of wp_count_comments().

#10 @SergeyBiryukov
10 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 37335:

Dashboard: Display the comment counts in wp_dashboard_right_now() in the rare initial condition when there are 0 approved comments and only pending comments, so the AJAX count update could work.

Props afercia.
Fixes #35519.

Note: See TracTickets for help on using tickets.