Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#19029 closed defect (bug) (fixed)

Delete Permanently comments one by one in Spams or Trash increases counter

Reported by: hebbet Owned by: duck_
Priority: normal Milestone: 3.3
Component: Comments Version: 3.0.5
Severity: normal Keywords: has-patch
Cc: Focuses:

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)

19029.diff (1.5 KB ) - added by duck_ 15 years ago.

Download all attachments as: .zip

Change History (14)

#1 @hebbet
15 years ago

  • Summary Delete Permanently one comment in Spams increases counterDelete Permanently comments one by one in Spams or Trash increases counter

also happens in Trash

#2 @ocean90
15 years ago

  • 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.

#3 @hebbet
15 years ago

i meant the items counter under the search box.

it also happens in 3.3 beta 2

#4 @ocean90
15 years ago

  • Keywords needs-patch added; reporter-feedback removed

Ok, now I see it.

Duplicate: #18963

#5 @duck_
15 years ago

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.

#6 @duck_
15 years ago

  • Version 3.2.13.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.

#7 follow-up: @thee17
15 years ago

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.

#8 in reply to: ↑ 7 @duck_
15 years ago

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.

@duck_
15 years ago

#9 @duck_
15 years ago

  • 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.

#10 @kurtpayne
15 years ago

  • Cc kpayne@… added

19029.diff works for me. One note: Clicking too fast results in the count getting out of sync. screenshot.

#11 @duck_
15 years ago

  • Owner set to duck_
  • Resolutionfixed
  • Status newclosed

In [19068]:

Stop an incorrect comment total being displayed when a trashed/spammed comment is deleted or restored. Fixes #19029.

Also only run getUpdate() when necessary and remove reference to non-existent "span.total-type-count".

#12 @duck_
15 years ago

  • Milestone Awaiting Review3.3

#13 @ramiy
15 years ago

related #17275

Note: See TracTickets for help on using tickets.