← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-add-expiry-date-to-participation-view into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-add-expiry-date-to-participation-view into launchpad:master.

Commit message:
Fix reversed conditions for showing team membership expiry dates

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/422675

Related to https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/422121.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-add-expiry-date-to-participation-view into launchpad:master.
diff --git a/lib/lp/registry/stories/team/xx-team-membership.txt b/lib/lp/registry/stories/team/xx-team-membership.txt
index 510a824..823f19c 100644
--- a/lib/lp/registry/stories/team/xx-team-membership.txt
+++ b/lib/lp/registry/stories/team/xx-team-membership.txt
@@ -219,7 +219,20 @@ Kiko has not joined any teams:
     >>> print(find_tag_by_id(anon_browser.contents, 'participation'))
     None
 
-Sample Person has both direct and indirect memberships:
+Sample Person has both direct and indirect memberships, and expiry dates are
+shown where relevant.  We force an expiration date to be in the past in
+order to avoid this test failing at some point in the future.
+
+    >>> import pytz
+    >>> from zope.security.proxy import removeSecurityProxy
+
+    >>> login('admin@xxxxxxxxxxxxx')
+    >>> name12 = personset.getByName('name12')
+    >>> lp_users = personset.getByName('launchpad-users')
+    >>> membership = teammembershipset.getByPersonAndTeam(name12, lp_users)
+    >>> removeSecurityProxy(membership).dateexpires = datetime(
+    ...     2009, 1, 1, tzinfo=pytz.UTC)
+    >>> logout()
 
     >>> anon_browser.open('http://launchpad.test/~name12/+participation')
     >>> content = find_main_content(anon_browser.contents)
@@ -227,13 +240,14 @@ Sample Person has both direct and indirect memberships:
     None
 
     >>> print(extract_text(
-    ...     find_tag_by_id(content, 'participation'), formatter='html'))
-    Team                  Joined      Expires   Role    Via                 Mailing List
-    HWDB Team             2009-07-09            Member  —              —
-    Landscape Developers  2006-07-11            Owner   —              —
-    Launchpad Users       2008-11-26            Owner   —              —
-    Ubuntu Gnome Team     —               Member  Warty Security Team  —
-    Warty Security Team   2007-01-26            Member  —              —
+    ...     find_tag_by_id(content, 'participation'),
+    ...     formatter='html'))  # noqa
+    Team                  Joined      Expires     Role    Via                 Mailing List
+    HWDB Team             2009-07-09  —     Member  —              —
+    Landscape Developers  2006-07-11  —     Owner   —              —
+    Launchpad Users       2008-11-26  2009-01-01  Owner   —              —
+    Ubuntu Gnome Team     —     —     Member  Warty Security Team  —
+    Warty Security Team   2007-01-26  —     Member  —              —
 
 User can see links to register teams and change their mailing list
 subscriptions on their own participation page.
@@ -261,4 +275,4 @@ list column.
     ...     find_tag_by_id(admin_browser.contents, 'participation'),
     ...     formatter='html'))
     Team                  Joined      Expires   Role    Via
-    Mailing List Experts  2007-10-04            Owner   —
+    Mailing List Experts  2007-10-04  —   Owner   —
diff --git a/lib/lp/registry/templates/person-participation.pt b/lib/lp/registry/templates/person-participation.pt
index 7620fca..67d2bbc 100644
--- a/lib/lp/registry/templates/person-participation.pt
+++ b/lib/lp/registry/templates/person-participation.pt
@@ -48,11 +48,11 @@
             </tal:no-date>
           </td>
           <td>
-            <tal:date condition="not: participation/dateexpires"
+            <tal:date condition="participation/dateexpires"
               tal:replace="participation/dateexpires/fmt:date">
               2005-06-17
             </tal:date>
-            <tal:no-date condition="participation/dateexpires">
+            <tal:no-date condition="not: participation/dateexpires">
               &mdash;
             </tal:no-date>
           </td>