Skip to content

Commit

Permalink
fixed invite link counting
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Jan 17, 2022
1 parent 745bb58 commit 8a7c4e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/forms.py
Expand Up @@ -351,8 +351,8 @@ def __init__(self, *args, **kwargs):

def clean(self):
space = self.cleaned_data['space']
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() + InviteLink.objects.filter(
space=space).filter(valid_until__gte=datetime.today()).count()) >= space.max_users:
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() +
InviteLink.objects.filter(valid_until__gte=datetime.today(), used_by=None, space=space).count()) >= space.max_users:
raise ValidationError(_('Maximum number of users for this space reached.'))

def clean_email(self):
Expand Down

0 comments on commit 8a7c4e1

Please sign in to comment.