Make WordPress Core

Opened 10 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's profile antonrinas Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.6 Priority: normal
Severity: minor Version: 4.1
Component: Comments Keywords: has-screenshots has-patch commit
Focuses: ui Cc:

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 10 years ago.
Dashboard screenshot
35519.patch (631 bytes) - added by afercia 10 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
10 years ago

Dashboard screenshot

#1 follow-up: @antonrinas
10 years ago

  • Severity changed from normal to minor

#2 in reply to: ↑ 1 @Latz
10 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
10 years ago

#3 @afercia
10 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
10 years ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.4.1 to 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 10 years ago by SergeyBiryukov (previous) (diff)

#5 @afercia
10 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
10 years ago

  • Milestone changed from Future Release to 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 set to fixed
  • Status changed from new to 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.