Skip to content

Commit

Permalink
fix(membership): international auto-membership
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Nov 14, 2023
1 parent 30ee4bf commit 5b086cd
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions fiesta/apps/accounts/services/user_profile_state_synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,8 @@ def revalidate_user_profile(self, profile: UserProfile):
@_if_enabled
def on_accounts_configuration_update(self, conf: SectionsConfiguration):
"""
After change of Accounts configuration, checks all COMPLETED profiles if they're fine for new configuration.
If not, profile is set to UNCOMPLETED.
Implements only change to more strict conditions, which is O(n).
Implementation with less strict conditions leads to O(n^2).
After change of Accounts configuration, mark all related user profiles for revalidation.
"""
if not self.ENABLED:
return

# for each connected user profile enforce revalidation
UserProfile.objects.filter(
user__memberships__section__plugins__configuration=conf,
Expand All @@ -99,8 +92,6 @@ def on_accounts_configuration_update(self, conf: SectionsConfiguration):

@_if_enabled
def on_membership_update(self, membership: SectionMembership):
if not self.ENABLED:
return None
try:
# membership could be created for user without profile (usually the first one membership)
profile: UserProfile = membership.user.profile
Expand Down

0 comments on commit 5b086cd

Please sign in to comment.