Merge lp:~sinzui/launchpad/mailing-list-subscribers-0 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Aaron Bentley |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11424 |
Proposed branch: | lp:~sinzui/launchpad/mailing-list-subscribers-0 |
Merge into: | lp:launchpad |
Diff against target: |
200 lines (+46/-44) 3 files modified
lib/lp/registry/browser/team.py (+2/-2) lib/lp/registry/model/mailinglist.py (+15/-13) lib/lp/registry/tests/test_mailinglist.py (+29/-29) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/mailing-list-subscribers-0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aaron Bentley (community) | Approve | ||
Review via email: mp+33279@code.launchpad.net |
Description of the change
This is my branch to walk the list of mailing list subscribers properly.
lp:~sinzui/launchpad/mailing-list-subscribers-0
Diff size: 201 (lint demanded a lot of fixes)
Launchpad bug:
https:/
Test command: ./bin/test -vv -t test_mailinglist
Pre-
Target release: 10.09
Walk the list of mailing list subscribers properly
-------
The table layout is abusing the batch navigator, asking for items by index,
causing a query for each user using the getSubscribers() query as the base,
adding an offset and a limit. Since the getSubscribers intends to return a all
users, sorted by display, asking for OFFSET 1, LIMIT 1 and OFFSET 2, LIMIT 2
are working with a pair of results, not one, and the table builder, expecting
only one, always uses the first one!
Adding the proposed Person.id fixes the issue. Using Person.name is clearer.
But the queries on the page remain outrageous. The table could create a list
of the users in the batch before it starts getting items by index so that a
single query for the user is needed.
Rules
-----
* Add displayname to the getSubscribers() order by clause to ensure
only 1 person can match repeated calls to OFFSET and Limit.
* Listify the current batch before the table starts using indexes to
get items so that one query is called to get all the subscribers
for the page.
QA
--
* Visit https:/
* Verify that Alain Portals is listed twice and each links to a different
user profile.
* View the source of the page and verify less than 129 queries were
issues (~79 queries)
Lint
----
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
Test
----
* lib/lp/
* Updated an older test for getSubscribers to use current rules
for unittests.
* Refactored the test so that another test could share the setup.
* Added a new test to verify that items are sorted by displayname
and name.
Implementation
--------------
* lib/lp/
* Listified the batch of persons. This is an internal optimisation
that had not test changes.
* lib/lp/
* Added Person.name to the order by clause to ensure a query with
LIMIT 1 OFFSET X will return a distinct row.