← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #793547 in Launchpad itself: "The "Derives from:" portlet should be updated to use DSP."
  https://bugs.launchpad.net/launchpad/+bug/793547

For more details, see:
https://code.launchpad.net/~allenap/launchpad/derives-from-portlet-bug-793547/+merge/63703

This changes the "Series information" portlet on DistroSeries:+index
to show derivation information when the derivation UI flag is enabled.

It also fixes a bug where "No derived series" was being shown when
there were derived series, and not being shown where there were none.

-- 
https://code.launchpad.net/~allenap/launchpad/derives-from-portlet-bug-793547/+merge/63703
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/specification.py'
--- lib/lp/blueprints/browser/specification.py	2011-06-07 04:39:03 +0000
+++ lib/lp/blueprints/browser/specification.py	2011-06-07 13:46:38 +0000
@@ -476,8 +476,13 @@
             text = 'Edit subscription'
             icon = 'edit'
         elif self.context.isSubscribed(user):
+<<<<<<< TREE
             text = 'Update subscription'
             icon = 'edit'
+=======
+            text = 'Update Subscription'
+            icon = 'edit'
+>>>>>>> MERGE-SOURCE
         else:
             text = 'Subscribe'
             icon = 'add'

=== modified file 'lib/lp/blueprints/stories/standalone/subscribing.txt'
--- lib/lp/blueprints/stories/standalone/subscribing.txt	2011-06-07 04:39:03 +0000
+++ lib/lp/blueprints/stories/standalone/subscribing.txt	2011-06-07 13:46:38 +0000
@@ -58,9 +58,17 @@
     >>> 'subscriber-essential' in browser.contents
     True
 
+<<<<<<< TREE
 Now the link should say "Update subscription" in the actions menu.
+=======
+Now the link should say "Edit Subscription" in the actions menu.
+>>>>>>> MERGE-SOURCE
 
+<<<<<<< TREE
     >>> submod_link = browser.getLink('Update subscription')
+=======
+    >>> submod_link = browser.getLink('Update Subscription')
+>>>>>>> MERGE-SOURCE
     >>> submod_link is not None
     True
 
@@ -102,7 +110,11 @@
 spec. We load the subscription page, and now the button says
 "Unsubscribe".
 
+<<<<<<< TREE
     >>> browser.getLink('Update subscription').click()
+=======
+    >>> browser.getLink('Update Subscription').click()
+>>>>>>> MERGE-SOURCE
     >>> unsubit = browser.getControl(name='unsubscribe')
     >>> unsubit.value
     'Unsubscribe'

=== modified file 'lib/lp/bugs/browser/bug.py'
=== modified file 'lib/lp/bugs/browser/tests/test_bug_views.py'
--- lib/lp/bugs/browser/tests/test_bug_views.py	2011-06-07 06:24:04 +0000
+++ lib/lp/bugs/browser/tests/test_bug_views.py	2011-06-07 13:46:38 +0000
@@ -203,48 +203,153 @@
                     self._hasCSSClass(html, 'mute-link-container', 'hidden'),
                     'No "hidden" CSS class in mute-link-container.')
 
-    def test_mute_subscription_link_not_rendered_for_anonymous(self):
-        # If a person is not already subscribed to a bug in some way,
-        # the mute link will not be displayed to them.
-        with FeatureFixture({self.feature_flag_1: 'on'}):
-            view = create_initialized_view(
-                self.bug, name="+portlet-subscription")
-            self.assertFalse(view.user_should_see_mute_link)
-            html = view.render()
-            self.assertFalse('mute_subscription' in html)
-
-    def test_mute_subscription_link_shown_if_muted(self):
-        # If a person is muted but not otherwise subscribed, they should still
-        # see the (un)mute link.
-        person = self.factory.makePerson()
-        with person_logged_in(person):
-            with FeatureFixture({self.feature_flag_1: 'on'}):
-                self.bug.mute(person, person)
-                # The user isn't subscribed already, but is muted.
-                self.assertFalse(self.bug.isSubscribed(person))
-                self.assertFalse(
-                    self.bug.personIsAlsoNotifiedSubscriber(
-                        person))
-                self.assertTrue(self.bug.isMuted(person))
-                view = create_initialized_view(
-                    self.bug, name="+portlet-subscription")
-                self.assertTrue(view.user_should_see_mute_link,
-                                "User should see mute link.")
-                contents = view.render()
-                self.assertTrue('mute_subscription' in contents,
-                                "'mute_subscription' not in contents.")
-                self.assertFalse(
-                    self._hasCSSClass(
-                        contents, 'mute-link-container', 'hidden'))
-
-    def test_mute_classes_work_for_anonymous_users(self):
-        # If a user is not logged in, the template shouldn't break
-        # horribly.
-        bug = self.factory.makeBug()
-        view = create_initialized_view(bug.default_bugtask, name="+index")
-        self.assertEqual(
-            'subscribed-false dup-subscribed-false',
-            view.current_user_subscription_class)
-        self.assertEqual(
-            'muted-false hidden subscribed-false dup-subscribed-false',
-            view.current_user_mute_class)
+<<<<<<< TREE
+    def test_mute_subscription_link_not_rendered_for_anonymous(self):
+        # If a person is not already subscribed to a bug in some way,
+        # the mute link will not be displayed to them.
+        with FeatureFixture({self.feature_flag_1: 'on'}):
+            view = create_initialized_view(
+                self.bug, name="+portlet-subscription")
+            self.assertFalse(view.user_should_see_mute_link)
+            html = view.render()
+            self.assertFalse('mute_subscription' in html)
+
+    def test_mute_subscription_link_shown_if_muted(self):
+        # If a person is muted but not otherwise subscribed, they should still
+        # see the (un)mute link.
+        person = self.factory.makePerson()
+        with person_logged_in(person):
+            with FeatureFixture({self.feature_flag_1: 'on'}):
+                self.bug.mute(person, person)
+                # The user isn't subscribed already, but is muted.
+                self.assertFalse(self.bug.isSubscribed(person))
+                self.assertFalse(
+=======
+    def test_mute_subscription_link_not_rendered_for_anonymous(self):
+        # If a person is not already subscribed to a bug in some way,
+        # the mute link will not be displayed to them.
+        with FeatureFixture({self.feature_flag_1: 'on'}):
+            view = create_initialized_view(
+                self.bug, name="+portlet-subscription")
+            self.assertFalse(view.user_should_see_mute_link)
+            html = view.render()
+            self.assertFalse('mute_subscription' in html)
+
+    def test_mute_subscription_link_shown_if_muted(self):
+        # If a person is muted but not otherwise subscribed, they should still
+        # see the (un)mute link.
+        person = self.factory.makePerson()
+        with person_logged_in(person):
+            with FeatureFixture({self.feature_flag_1: 'on'}):
+                self.bug.mute(person, person)
+                # The user isn't subscribed already, but is muted.
+                self.assertFalse(self.bug.isSubscribed(person))
+                self.assertFalse(
+                    self.bug.personIsAlsoNotifiedSubscriber(
+                        person))
+                self.assertTrue(self.bug.isMuted(person))
+                view = create_initialized_view(
+                    self.bug, name="+portlet-subscription")
+                self.assertTrue(view.user_should_see_mute_link,
+                                "User should see mute link.")
+                contents = view.render()
+                self.assertTrue('mute_subscription' in contents,
+                                "'mute_subscription' not in contents.")
+                self.assertFalse(
+                    self._hasCSSClass(
+                        contents, 'mute-link-container', 'hidden'))
+
+    def test_mute_link_shown_for_team_subscription_to_duplicate(self):
+        # If the person belongs to a team with a structural subscription to a
+        # duplicate of this bug, then the mute link will be displayed to them.
+        person = self.factory.makePerson(name="a-person")
+        team_owner = self.factory.makePerson(name="team-owner")
+        team = self.factory.makeTeam(owner=team_owner, name="subscribed-team")
+        dupe = self.factory.makeBug()
+        with person_logged_in(self.bug.owner):
+            dupe.markAsDuplicate(self.bug)
+            with person_logged_in(team_owner):
+                team.addMember(person, team_owner)
+                dupe_target = dupe.default_bugtask.target
+                dupe_target.addBugSubscription(team, team_owner)
+        with person_logged_in(person):
+            with FeatureFixture({self.feature_flag_1: 'on'}):
+                self.assertFalse(self.bug.isMuted(person))
+                # This is a sanity check for the test.
+                self.assertFalse(self.bug.duplicates.is_empty())
+                self.assertEqual(self.bug, dupe.duplicateof)
+                self.assertTrue(
+>>>>>>> MERGE-SOURCE
+                    self.bug.personIsAlsoNotifiedSubscriber(
+                        person))
+                self.assertTrue(self.bug.isMuted(person))
+                view = create_initialized_view(
+                    self.bug, name="+portlet-subscription")
+                self.assertTrue(view.user_should_see_mute_link,
+                                "User should see mute link.")
+                contents = view.render()
+<<<<<<< TREE
+                self.assertTrue('mute_subscription' in contents,
+                                "'mute_subscription' not in contents.")
+                self.assertFalse(
+                    self._hasCSSClass(
+                        contents, 'mute-link-container', 'hidden'))
+=======
+                self.assertTrue('mute_subscription' in contents)
+                create_initialized_view(
+                    self.bug.default_bugtask, name="+mute",
+                    form={'field.actions.mute': 'Mute bug mail'})
+                self.assertTrue(self.bug.isMuted(person))
+>>>>>>> MERGE-SOURCE
+
+<<<<<<< TREE
+    def test_mute_classes_work_for_anonymous_users(self):
+        # If a user is not logged in, the template shouldn't break
+        # horribly.
+        bug = self.factory.makeBug()
+        view = create_initialized_view(bug.default_bugtask, name="+index")
+        self.assertEqual(
+            'subscribed-false dup-subscribed-false',
+            view.current_user_subscription_class)
+        self.assertEqual(
+            'muted-false hidden subscribed-false dup-subscribed-false',
+            view.current_user_mute_class)
+=======
+    def test_mute_subscription_link_shown_for_team_direct_subscription(self):
+        # If the person belongs to a team with a direct subscription,
+        # then the mute link will be displayed to them.
+        person = self.factory.makePerson(name="a-person")
+        team_owner = self.factory.makePerson(name="team-owner")
+        team = self.factory.makeTeam(owner=team_owner, name="subscribed-team")
+        with FeatureFixture({self.feature_flag_1: 'on'}):
+            with person_logged_in(team_owner):
+                team.addMember(person, team_owner)
+                self.bug.subscribe(team, team_owner)
+            with person_logged_in(person):
+                self.assertFalse(self.bug.isMuted(person))
+                self.assertTrue(
+                    self.bug.personIsAlsoNotifiedSubscriber(person),
+                    "Person should be a notified subscriber")
+                view = create_initialized_view(
+                    self.bug, name="+portlet-subscription")
+                self.assertTrue(view.user_should_see_mute_link,
+                                "User should see mute link.")
+                contents = view.render()
+                self.assertTrue('mute_subscription' in contents)
+                create_initialized_view(
+                    self.bug.default_bugtask, name="+mute",
+                    form={'field.actions.mute': 'Mute bug mail'})
+                self.assertTrue(self.bug.isMuted(person))
+
+    def test_mute_classes_work_for_anonymous_users(self):
+        # If a user is not logged in, the template shouldn't break
+        # horribly.
+        bug = self.factory.makeBug()
+        view = create_initialized_view(bug.default_bugtask, name="+index")
+        self.assertEqual(
+            'subscribed-false dup-subscribed-false',
+            view.current_user_subscription_class)
+        self.assertEqual(
+            'muted-false hidden subscribed-false dup-subscribed-false',
+            view.current_user_mute_class)
+>>>>>>> MERGE-SOURCE

=== modified file 'lib/lp/bugs/model/bug.py'
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
=== modified file 'lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py'
=== modified file 'lib/lp/registry/stories/distroseries/xx-distroseries-index.txt'
--- lib/lp/registry/stories/distroseries/xx-distroseries-index.txt	2011-05-24 10:08:33 +0000
+++ lib/lp/registry/stories/distroseries/xx-distroseries-index.txt	2011-06-07 13:46:38 +0000
@@ -51,13 +51,56 @@
     Release manager: None
     Status: Current Stable Release
     Derives from: Warty (4.10) is not derived from another series.
+<<<<<<< TREE
     Derived series:
+=======
+    Derived series: No derived series.
+>>>>>>> MERGE-SOURCE
     Source packages: 3
     Binary packages: 4
 
 On series that have no source or binary packages, the portlet will
 change its text slightly to annouce this:
 
+    >>> anon_browser.open('http://launchpad.dev/debian/sarge')
+    >>> print extract_text(
+    ...     find_portlet(anon_browser.contents, 'Series information'))
+    Series information
+    Distribution: Debian
+    Series: Sarge (3.1)
+    Project drivers: Jeff Waugh, Mark Shuttleworth
+    Release manager: Jeff Waugh
+    Status: Pre-release Freeze
+    Derives from: Woody (3.0)
+    Source packages: No sources imported or published.
+    Binary packages: No binaries imported or published.
+
+The series' derivation parents - rather than the previous series - are
+shown when derivation is enabled, as are the series derived from this
+series:
+
+    >>> from lp.registry.interfaces.distribution import IDistributionSet
+    >>> from lp.testing import celebrity_logged_in
+    >>> from zope.component import getUtility
+
+    >>> with celebrity_logged_in("admin"):
+    ...     debian = getUtility(IDistributionSet).getByName(u"debian")
+    ...     sarge = debian.getSeries(u"sarge")
+    ...     parents = [
+    ...         factory.makeDistroSeries(name=u"dobby"),
+    ...         factory.makeDistroSeries(name=u"knobby")]
+    ...     distro_series_parents = [
+    ...         factory.makeDistroSeriesParent(
+    ...             derived_series=sarge, parent_series=parent)
+    ...         for parent in parents]
+    ...     children = [
+    ...         factory.makeDistroSeries(name=u"bobby"),
+    ...         factory.makeDistroSeries(name=u"tables")]
+    ...     distro_series_children = [
+    ...         factory.makeDistroSeriesParent(
+    ...             derived_series=child, parent_series=sarge)
+    ...         for child in children]
+
     >>> with derivation_enabled:
     ...     anon_browser.open('http://launchpad.dev/debian/sarge')
     >>> print extract_text(
@@ -68,8 +111,13 @@
     Project drivers: Jeff Waugh, Mark Shuttleworth
     Release manager: Jeff Waugh
     Status: Pre-release Freeze
+<<<<<<< TREE
     Derives from: Woody (3.0)
     Derived series:
+=======
+    Derives from: Dobby (...), Knobby (...)
+    Derived series: Bobby (...), Tables (...)
+>>>>>>> MERGE-SOURCE
     Source packages: No sources imported or published.
     Binary packages: No binaries imported or published.
 

=== modified file 'lib/lp/registry/templates/distroseries-details.pt'
--- lib/lp/registry/templates/distroseries-details.pt	2011-05-24 10:08:33 +0000
+++ lib/lp/registry/templates/distroseries-details.pt	2011-06-07 13:46:38 +0000
@@ -46,6 +46,9 @@
       </dd>
     </dl>
 
+    <tal:derivation-not-enabled
+        tal:condition="not:request/features/soyuz.derived_series_ui.enabled">
+
     <dl>
       <dt>Derives from:</dt>
       <dd>
@@ -60,8 +63,32 @@
       </dd>
     </dl>
 
+<<<<<<< TREE
     <dl tal:condition="request/features/soyuz.derived_series_ui.enabled"
         tal:define="all_child_series context/getDerivedSeries">
+=======
+    </tal:derivation-not-enabled>
+
+    <tal:derivation-enabled
+        tal:condition="request/features/soyuz.derived_series_ui.enabled">
+
+    <dl tal:define="parents context/getParentSeries">
+      <dt>Derives from:</dt>
+      <dd tal:condition="parents">
+        <tal:parents repeat="parent parents">
+          <a tal:attributes="href parent/fmt:url"
+             tal:content="parent/named_version">
+          </a><tal:comma condition="not:repeat/parent/end">, </tal:comma>
+        </tal:parents>
+      </dd>
+      <dd tal:condition="not:parents">
+        <tal:name replace="context/named_version"/> is not derived from
+        another series.
+      </dd>
+    </dl>
+
+    <dl tal:define="all_child_series context/getDerivedSeries">
+>>>>>>> MERGE-SOURCE
       <dt>Derived series:</dt>
       <dd>
         <tal:per_child_series repeat="child_series all_child_series">
@@ -70,12 +97,18 @@
             tal:content="child_series/named_version" /><tal:comma
             condition="not: repeat/child_series/end">,</tal:comma>
         </tal:per_child_series>
+<<<<<<< TREE
        <tal:none condition="all_child_series">
+=======
+        <tal:none condition="not:all_child_series">
+>>>>>>> MERGE-SOURCE
           No derived series.
         </tal:none>
       </dd>
     </dl>
 
+    </tal:derivation-enabled>
+
     <dl tal:define="sourcecount context/sourcecount">
       <dt>Source packages:</dt>
       <dd