launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03286
[Merge] lp:~wallyworld/launchpad/disabled-project-bugs-shown into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/disabled-project-bugs-shown into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #682863 in Launchpad itself: "bugtasks on disabled projects are shown on bug pages"
https://bugs.launchpad.net/launchpad/+bug/682863
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/disabled-project-bugs-shown/+merge/57265
A simple fix to prevent the bug tasks table from showing tasks for inactive projects and product/distro series.
== Implementation ==
Modify the list comprehensions in BugTask.getBugTaskAndNominationViews()
If you navigate to the inactive project, it is still possible to click through from there to a related bug. But when you get to the bug index page, there will be no bug task entry for the inactive project, which is fine.
== Tests ==
Add to existing bugs/browser/tests/bug-views.txt doc test
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/browser/bugtask.py
lib/lp/bugs/browser/tests/bug-views.txt
./lib/lp/bugs/browser/tests/bug-views.txt
169: want exceeds 78 characters.
211: source has trailing whitespace.
--
https://code.launchpad.net/~wallyworld/launchpad/disabled-project-bugs-shown/+merge/57265
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/disabled-project-bugs-shown into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2011-03-30 11:36:37 +0000
+++ lib/lp/bugs/browser/bugtask.py 2011-04-12 01:38:29 +0000
@@ -3217,11 +3217,13 @@
upstream_tasks = [
bugtask for bugtask in bugtasks
- if bugtask.product or bugtask.productseries]
+ if (bugtask.product and bugtask.product.active)
+ or (bugtask.productseries and bugtask.productseries.active)]
distro_tasks = [
bugtask for bugtask in bugtasks
- if bugtask.distribution or bugtask.distroseries]
+ if bugtask.distribution
+ or (bugtask.distroseries and bugtask.distroseries.active)]
upstream_tasks.sort(key=_by_targetname)
distro_tasks.sort(key=_by_targetname)
=== modified file 'lib/lp/bugs/browser/tests/bug-views.txt'
--- lib/lp/bugs/browser/tests/bug-views.txt 2011-03-23 16:28:51 +0000
+++ lib/lp/bugs/browser/tests/bug-views.txt 2011-04-12 01:38:29 +0000
@@ -492,6 +492,55 @@
bugtask, New, mozilla-firefox (Ubuntu)
nomination, Nominated, Ubuntu Hoary
+Bugtasks should only be listed for active projects and (product|distro)series.
+
+ >>> from lp.registry.interfaces.series import SeriesStatus
+
+ >>> product_foo = factory.makeProduct(name="foo")
+ >>> productseries_foo = factory.makeProductSeries(
+ ... name="fooseries", product=product_foo)
+ >>> product_bar = factory.makeProduct(name="bar")
+ >>> productseries_bar = factory.makeProductSeries(
+ ... name="barseries", product=product_bar)
+ >>> ubuntuseries_foo = factory.makeDistroRelease(
+ ... distribution=ubuntu, name="foo")
+ >>> ubuntuseries_bar = factory.makeDistroRelease(
+ ... distribution=ubuntu, name="bar", status=SeriesStatus.EXPERIMENTAL)
+
+ >>> foo_bug = factory.makeBug(product=product_foo)
+
+ >>> bugtaskset.createTask(
+ ... owner=current_user, bug=foo_bug, product=product_bar)
+ <BugTask ...>
+ >>> bugtaskset.createTask(
+ ... owner=current_user, bug=foo_bug, productseries=productseries_foo)
+ <BugTask ...>
+ >>> bugtaskset.createTask(
+ ... owner=current_user, bug=foo_bug, productseries=productseries_bar)
+ <BugTask ...>
+ >>> bugtaskset.createTask(
+ ... owner=current_user, bug=foo_bug, distroseries=ubuntuseries_foo)
+ <BugTask ...>
+ >>> bugtaskset.createTask(
+ ... owner=current_user, bug=foo_bug, distroseries=ubuntuseries_bar)
+ <BugTask ...>
+
+ >>> product_bar.active = False
+ >>> productseries_bar.status = SeriesStatus.EXPERIMENTAL
+
+ >>> foo_bugtasks_and_nominations_view = getMultiAdapter(
+ ... (foo_bug, request),
+ ... name="+bugtasks-and-nominations-table")
+ >>> foo_bugtasks_and_nominations_view.initialize()
+
+ >>> task_and_nomination_views = (
+ ... foo_bugtasks_and_nominations_view.getBugTaskAndNominationViews())
+
+ >>> print_tasks_and_nominations(task_and_nomination_views)
+ bugtask, New, Foo
+ bugtask, New, Foo fooseries
+ bugtask, New, Ubuntu Foo
+
After creating bug supervisors for Ubuntu and Firefox Let's nominate the bug
for upstream and an Ubuntu series and see how the list changes.