Merge lp:~sinzui/launchpad/delete-team-3 into lp:launchpad
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 11858 | ||||||||||||||||
Proposed branch: | lp:~sinzui/launchpad/delete-team-3 | ||||||||||||||||
Merge into: | lp:launchpad | ||||||||||||||||
Diff against target: |
788 lines (+227/-207) 10 files modified
lib/lp/registry/browser/peoplemerge.py (+37/-8) lib/lp/registry/browser/team.py (+7/-9) lib/lp/registry/browser/tests/mailinglist-views.txt (+6/-8) lib/lp/registry/browser/tests/peoplemerge-views.txt (+2/-28) lib/lp/registry/browser/tests/test_peoplemerge.py (+62/-1) lib/lp/registry/interfaces/person.py (+21/-8) lib/lp/registry/model/person.py (+23/-11) lib/lp/registry/stories/mailinglists/lifecycle.txt (+14/-125) lib/lp/registry/templates/team-delete.pt (+2/-2) lib/lp/registry/tests/test_teammembership.py (+53/-7) |
||||||||||||||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/delete-team-3 | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Henning Eggers (community) | code | Approve | |
Review via email: mp+39746@code.launchpad.net |
Description of the change
This is my branch to unblock owners from deleting their teams.
lp:~sinzui/launchpad/delete-team-3
Diff size: 492
Launchpad bug:
https:/
https:/
https:/
https:/
Test command: ./bin/test -vv --layer=
-t peoplemerge-views -t mailinglist-views
-t test_peoplemerge -t test_teammembership
Pre-
Target release: 10.11
Unblock owners from deleting their teams
-------
The registry team continues to help owners delete there teams. Owners often
cannot delete the team because it has an unpurged mailing list or super
teams:
523985 teams cannot purge their mailing list
Owners cannot purge mailing lists, a registry admin can. But in the
case of deleting a team with a deactivated the mailing list, we know
no one can use the list, so it is okay to automatically purge.
599464 Can't delete team with super teams
The code doing the delete action *thinks* it is doing a merge action.
Merge cannot handle super teams because there is a chance that a cyclic
team member error will occur. But since delete removes the team members,
there is never any chance of a cyclic error. Actually, the delete step
should remove the team from the super teams immediately after the
membership is removed.
589125 Message about deactivating the mailing list when deleting a team
needs bling
The sentence saying that the delete cannot be performed until the mailing
list is purged could be bold to alert the user.
577079 PersonSet.merge must delete the team email address
The subclass that delete teams removes the email address, but this
rule applies to all team merges. Move the rule to the base class.
Rules
-----
On closer examination, these issues affect users merging teams too. An owner
who is merging his team into the ~registry team is doing a delete, and he
is stuck as well. (The delete rules preselect the teams used in a merge).
* Allow owners to purge lists.
* Update the rules to permit the owner to delete a team when the view
cane safely purge the mailing list.
* Allow admins/owners to retract their team's membership in another team.
* Update the merge rules to remove the team from its super teams
before it starts the merge into ~registry.
QA
--
* Visit open team delete questions that are blocked by lists and
super teams.
* Delete all the teams.
* Rejoice that this is that last time this will ever need to be done
by a Registry Admins.
Lint
----
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Test
----
lib/lp/
* Updated tests to document that an owner can purge a mailing list.
* This test was broken! The setup of the owner never worked (the
view was testing anonymous). The setup of logged in user was testing
the view implementation of security; the test now logs the correct
user in to verify the permissions.
lib/lp/
* Removed doctest. There is a revised test added to test_peoplemerge
lib/lp/
* Added tests for AdminTeamMergeV
addresses, mailing lists, and super teams.
lib/lp/
* Added tests to verify that memberships can be retracted and that the
TeamMember
* Updated the tests to run on the correct layer.
Implementation
--------------
lib/lp/
* Moved the delete team email address rule from the delete view to
AdminTeam
* Extended AdminTeamMergeView to purge mailing lists when possible and
to remove super teams when the merge is with Registry Admins.
lib/lp/
* Replaced the view implementation of security with standard security
checkers. This change implicitly allows the team owner to purge his
list.
lib/lp/
* Added retractTeamMemb
* This is a partial fix for bugs 239486 and 656782 where users cannot
retract memberships in PENDING or INVITED states. Savvy user can
use the API to fix the issue. The real fix will require a lot of
UI work.
lib/lp/
* Reimplemented Person.leave() to be a specific case of
Person.
* Added retractTeamMemb
method.
* PENDING and INVITED states are supported because there are edge cases
in production where users want to delete a team, but it has a
membership stuck in a another team's join queue.
lib/lp/
* Made the mailing list message bold so that users immediately know why
there is not Delete button shown on the page.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Curtis,
thank you for your many fixes and the extensive cover letter. Much appreciated.
An overall note on tests comments: "Verify ..." is noise on a test comment
because "verifying" is what tests are supposed to be doing. Our style guide
even mentions that. They are fixed easily, though:
# Verify that inactive lists do not block merges.
becomes
# Inactive lists do not block merges.
Am 01.11.2010 14:12, schrieb Curtis Hovey: registry/ browser/ peoplemerge. py' registry/ browser/ peoplemerge. py 2010-09-23 15:34:05 +0000 registry/ browser/ peoplemerge. py 2010-11-01 13:11:51 +0000 launchpad. webapp. interfaces import ILaunchBag interfaces. mailinglist import MailingListStatus interfaces. mailinglist import PURGE_STATES interfaces. person import ( geSchema, Schema, erge, propertycache import cachedproperty rgeView( LaunchpadFormVi ew): self, team): list.status != MailingListStat us.PURGED) list.status not in PURGE_STATES) experts( self): ILaunchpadCeleb rities) .registry_ experts person. mailing_ list is not None: person. mailing_ list.purge( )
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -34,13 +34,14 @@
> LaunchpadView,
> )
> from canonical.
> -from lp.registry.
> +from lp.registry.
> from lp.registry.
> IAdminPeopleMer
> IAdminTeamMerge
> IPersonSet,
> IRequestPeopleM
> )
> +from lp.services.
>
>
> class RequestPeopleMe
> @@ -216,7 +217,27 @@
> def hasMailingList(
> return (
> team.mailing_list is not None
> - and team.mailing_
> + and team.mailing_
> +
> + @cachedproperty
> + def registry_
> + return getUtility(
> +
> + def doMerge(self, data):
> + """Purge the non-transferable team data and merge."""
> + # A team cannot have more than one mailing list. The old list will
> + # remain in the archive.
> + if self.dupe_
> + self.dupe_
> + # A team cannot have more than one email address; they are not
Well "it is not transferable" sounds more reasonable to me because it is just
one address.
> + # transferable because the identity of the team has changed. person. setContactAddre ss(None) experts: person. teams_participa ted_in: person. retractTeamMemb ership( team, self.user) MergeView, self).doMerge(data) MergeView, self).validate( data) super_teams. count() > 0: person' ]
> + self.dupe_
> + # The registry experts does not want to acquire super teams from a
> + # merge.
> + if self.target_person is self.registry_
> + for team in self.dupe_
> + self.dupe_
> + super(AdminTeam
>
> def validate(self, data):
> """Check there are no mailing lists associated with the dupe team."""
> @@ -228,9 +249,14 @@
>
> super(AdminTeam
> dupe_team = data['dupe_person']
> - # Our code doesn't know how to merge a team's superteams, so we
> - # prohibit that here.
> - if dupe_team.
> + target_team = data['target_
> + # Merge cannot reconcile cyclic membership in super teams.
> + # Super team memberships are automatically removed when merging into
> + # the re...