Merge lp:~jcsackett/launchpad/hidden-comment-count-error into lp:launchpad
Status: | Merged |
---|---|
Approved by: | j.c.sackett |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15599 |
Proposed branch: | lp:~jcsackett/launchpad/hidden-comment-count-error |
Merge into: | lp:launchpad |
Diff against target: |
96 lines (+67/-1) 2 files modified
lib/lp/bugs/browser/bugtask.py (+6/-1) lib/lp/bugs/browser/tests/test_bugtask.py (+61/-0) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/hidden-comment-count-error |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Richard Harding (community) | Approve | ||
Review via email:
|
Commit message
Fixes calculation of the number of hidden comments in the collapsed comment widget.
Description of the change
Summary
=======
There are two problems with the current hidden comment/activity collapse
display; it can claim there are more hidden comments are hidden then there
are, and it can claim negative comments. Both of these have to do with the
arrangement of comment indices.
This fixes up some math in the figuring of hidden comments and adds tests to
the display of the collapsed comments.
Preimp
======
Spoke with Curtis Hovey.
Implementation
==============
The original calculation was broken by design. When a break in visible
comments was detected, it determined the number missing was the difference
between the previous visible comment's index and the current one. But:
1) indices can occasionally be in reverse order, owing to mail messages.
2) The number of items between two items isn't the difference of their
indices. It's one less than that difference. (There is one number between 1
and 3, not 2).
To correct these, we can just get one less than the absolute difference
between the two visible comments.
Tests
=====
bin/test -vvct TestCommentColl
QA
==
Go play with hiding some comments and make sure the numbers are correct on
page load without all comments showing.
LoC
===
This is part of the already resourced disclore arc. Plus, after this we can
remove some feature flags which reduces LoC.
Lint
====
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
Works for me so long as the log files goes away. Thanks for the fix.