launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27905
[Merge] ~lgp171188/launchpad:fix-optimize-has-any-bug-role-bulk-team-membership-checks into launchpad:master
Guruprasad has proposed merging ~lgp171188/launchpad:fix-optimize-has-any-bug-role-bulk-team-membership-checks into launchpad:master.
Commit message:
Fix the team membership check bug in the inAnyTeam() method
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/413792
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:fix-optimize-has-any-bug-role-bulk-team-membership-checks into launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 7d4950e..09e1bca 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -1347,10 +1347,13 @@ class Person(
if not teams:
return False
- team_ids = {team.id for team in teams if team.is_team}
- if self.id in team_ids:
- # A team is always a member of itself.
- return True
+ team_ids = set()
+ for team in teams:
+ if self.id == team.id:
+ # A team is always a member of itself
+ return True
+ if team.is_team:
+ team_ids.add(team.id)
if self._inTeam_cache is None:
# Initialize cache
Follow ups