Update pagination links on edit-comments when approving/deleting/etc
|Reported by:||mdawaffe||Owned by:||anonymous|
If you have 23 comments pending approval, and you approve 3 of them, the pagination links should reflect the fact that there is now only 1 page worth of comments.
Attached keeps track of how many total comments there are (for that comment view: all, pending, approved...) and keeps the displayed total and displayed page links up to date.
This also keeps the total and the pagination links up to date in the event of new comments coming in.
- When a comment is removed, the total decrements: no DB access needed.
- Comment totals are calculated explicitly from the DB when:
- The browser thinks the total number of pages is about to change.
- Randomly at a frequency of 1/$per_page.
The first time to reset the total and page links to the real value, the second time to keep everyone honest.
- All AJAX data is sent back to the browser with a timestamp, so the JS can decide if the new total is more or less up to date than what it thinks.