#19029 closed defect (bug) (fixed)
Delete Permanently comments one by one in Spams or Trash increases counter
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Comments | Version: | 3.0.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | kpayne@… |
Description
Repro:
*Have eg 25 Comments in Spam.
*Delete five using Delete Permanently one by one.
What happens:
After you one comment counter is correct (24), but when you delete the second, third... comment counter will increase (25, 26, 27, 28, 29)
Attachments (1)
Change History (14)
- Summary changed from Delete Permanently one comment in Spams increases counter to Delete Permanently comments one by one in Spams or Trash increases counter
- Keywords reporter-feedback added
Can you reproduce it in 3.3 beta 2 or trunk version? I can't either in 3.2.1 nor trunk.
i meant the items counter under the search box.
it also happens in 3.3 beta 2
- Keywords needs-patch added; reporter-feedback removed
Ok, now I see it.
Duplicate: #18963
After a bit of investigation the problem appears to be in delAfter in edit-comments.js. I notice that getUpdate('trash') returns -1. So, total = total - spam - trash actually increments the total count. This incremented total is sent on successive delete requests and the visible numbers start going wrong too.
if ( $(settings.target).parent().is('span.' + s) )
return 1;
else if ( $('#' + settings.element).is('.' + s) )
return -1;
the first branch isn't entered as $(settings.target).parent() is a span with class "delete" and not "trash". The return -1 branch is as the comment row does have the trash class.
- Version changed from 3.2.1 to 3.0.5
Present in 3.0.6 too (not checked earlier). You must have paginated the comments list for it to apply then so that "Displaying 1-x of y" is shown.
You do not have to have paginate on. It will do the same thing to "x Items" on the upper right, the number in brackets in "Spam (36) | Trash (0)" count properly.
Replying to thee17:
You do not have to have paginate on. It will do the same thing to "x Items" on the upper right, the number in brackets in "Spam (36) | Trash (0)" count properly.
I was talking about reproducing in 3.0.6 and possibly earlier. For 3.2.x and trunk you're correct reproduction doesn't need pagination.
- Keywords has-patch added; needs-patch removed
Attached 19029.diff.
The fix for the bug described is the logic change to updating the total value at the bottom. We want to decrement the displayed total unless a trash/spam is being undone.
Also removed the span.total-type-count update code as "total-type-count" isn't referenced anywhere else in WordPress core. The total updates now take place inline using .displaying-num. Updated the comment accompanying updateTotalCount() accordingly.
comment:10
kurtpayne — 19 months ago
- Cc kpayne@… added
19029.diff works for me. One note: Clicking too fast results in the count getting out of sync. screenshot.
comment:11
duck_ — 19 months ago
- Owner set to duck_
- Resolution set to fixed
- Status changed from new to closed
In [19068]:
comment:12
duck_ — 19 months ago
- Milestone changed from Awaiting Review to 3.3
comment:13
ramiy — 19 months ago
related #17275

also happens in Trash