Skip to content

Commit

Permalink
accomodating comments
Browse files Browse the repository at this point in the history
  • Loading branch information
why-not-try-calmer committed Sep 4, 2023
1 parent 8257138 commit 608b29b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions docker-app/qfieldcloud/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,10 @@ def clean(self) -> None:
if self.project.owner.is_organization:
organization = Organization.objects.get(pk=self.project.owner.pk)
if self.collaborator.is_person:
members_qs = organization.members.filter(member=self.collaborator) # type: ignore

# for organizations-owned projects, the candidate collaborator
# must be a member of the organization or the organization's owner
if not (
members_qs.exists()
organization.members.filter(member=self.collaborator).exists() # type: ignore
or self.collaborator == organization.organization_owner
):
raise ValidationError(
Expand Down
9 changes: 2 additions & 7 deletions docker-app/qfieldcloud/core/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,11 @@ def setup_subscription_plans():


def set_subscription(
some_user: User | Iterable[User],
users: User | Iterable[User],
code: str = None,
**kwargs,
):
users: list[User] = []

if isinstance(some_user, User):
users.append(some_user)
else:
users += some_user
users: list[User] = [users] if isinstance(users, User) else users
assert len(
users
), "When iterable, the first argument must contain at least 1 element."
Expand Down

0 comments on commit 608b29b

Please sign in to comment.