diff --git a/apiserver/plane/graphql/mutations/issue.py b/apiserver/plane/graphql/mutations/issue.py index f121d899e5..06ebde168d 100644 --- a/apiserver/plane/graphql/mutations/issue.py +++ b/apiserver/plane/graphql/mutations/issue.py @@ -119,14 +119,14 @@ class IssueMutation: await sync_to_async(IssueAssignee.objects.bulk_create)( [ IssueAssignee( - assignee_id=user, + assignee_id=assignee, issue=issue, workspace=workspace, project_id=project, created_by_id=user.id, updated_by_id=user.id, ) - for user in assignees + for assignee in assignees ], batch_size=10, ) diff --git a/apiserver/plane/graphql/types/issue.py b/apiserver/plane/graphql/types/issue.py index ab2f048d6b..38e9562196 100644 --- a/apiserver/plane/graphql/types/issue.py +++ b/apiserver/plane/graphql/types/issue.py @@ -11,7 +11,6 @@ import strawberry_django from strawberry.scalars import JSON from strawberry.types import Info - # Module Imports from plane.db.models import ( Issue, @@ -23,6 +22,7 @@ from plane.db.models import ( CycleIssue, ModuleIssue, IssueType, + ProjectMember, ) @@ -77,16 +77,14 @@ class IssuesType: return self.state_id @strawberry.field - def parent(self) -> Optional[strawberry.ID]: - return ( - self.parent_id - if self.parent_id - and self.parent.project.id != self.project_id - and self.parent.project.project__member.filter( - member_id=self.created_by, is_active=True, deleted_at__isnull=True - ).exists() - else None - ) + async def parent(self) -> Optional[strawberry.ID]: + if self.parent: + parent_issue_project_id = await sync_to_async( + lambda: self.parent.project_id if self.parent else None + )() + if parent_issue_project_id == self.project_id: + return str(self.parent_id) + return None @strawberry.field def project(self) -> int: