Skip to content

Commit

Permalink
Prevent error when anonymous user requests allergies
Browse files Browse the repository at this point in the history
  • Loading branch information
itsisak committed May 22, 2024
1 parent f05b31f commit 732e411
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lego/apps/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def user_should_see_regs(self, user: User) -> bool:
)

def user_should_see_allergies(self, user: User) -> bool:
if user.is_anonymous:
return False

Check warning on line 138 in lego/apps/events/models.py

View check run for this annotation

Codecov / codecov/patch

lego/apps/events/models.py#L138

Added line #L138 was not covered by tests
memberships = Membership.objects.filter(user=user)
in_responsible_group = self.responsible_group in [
mem.abakus_group for mem in memberships
Expand Down

0 comments on commit 732e411

Please sign in to comment.