diff --git a/apiserver/plane/api/views/importer.py b/apiserver/plane/api/views/importer.py index b9a7fe0c5..2e0f1cec0 100644 --- a/apiserver/plane/api/views/importer.py +++ b/apiserver/plane/api/views/importer.py @@ -363,6 +363,7 @@ class BulkImportIssuesEndpoint(BaseAPIView): start_date=issue_data.get("start_date", None), target_date=issue_data.get("target_date", None), priority=issue_data.get("priority", None), + created_by=request.user, ) ) @@ -400,7 +401,6 @@ class BulkImportIssuesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for label_id in labels_list ] @@ -420,7 +420,6 @@ class BulkImportIssuesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for assignee_id in assignees_list ] @@ -439,6 +438,7 @@ class BulkImportIssuesEndpoint(BaseAPIView): workspace_id=project.workspace_id, comment=f"{request.user.email} importer the issue from {service}", verb="created", + created_by=request.user, ) for issue in issues ], @@ -457,7 +457,6 @@ class BulkImportIssuesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for comment in comments_list ] @@ -474,7 +473,6 @@ class BulkImportIssuesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for issue, issue_data in zip(issues, issues_data) ] @@ -512,7 +510,6 @@ class BulkImportModulesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for module in modules_data ], @@ -536,7 +533,6 @@ class BulkImportModulesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for module, module_data in zip(modules, modules_data) ], @@ -554,7 +550,6 @@ class BulkImportModulesEndpoint(BaseAPIView): project_id=project_id, workspace_id=project.workspace_id, created_by=request.user, - updated_by=request.user, ) for issue in module_issues_list ] diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 869bd15c9..3851e31c1 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -161,6 +161,7 @@ class ProjectViewSet(BaseViewSet): workspace=serializer.instance.workspace, group=state["group"], default=state.get("default", False), + created_by=request.user, ) for state in states ] @@ -344,6 +345,7 @@ class UserProjectInvitationsViewset(BaseViewSet): workspace=invitation.project.workspace, member=request.user, role=invitation.role, + created_by=request.user, ) for invitation in project_invitations ] @@ -465,6 +467,7 @@ class AddTeamToProjectEndpoint(BaseAPIView): project_id=project_id, member_id=member, workspace=workspace, + created_by=request.user, ) ) @@ -612,6 +615,7 @@ class ProjectJoinEndpoint(BaseAPIView): if workspace_role >= 15 else (15 if workspace_role == 10 else workspace_role), workspace=workspace, + created_by=request.user, ) for project_id in project_ids ], diff --git a/apiserver/plane/api/views/workspace.py b/apiserver/plane/api/views/workspace.py index 8a2791e3b..7f47c5baf 100644 --- a/apiserver/plane/api/views/workspace.py +++ b/apiserver/plane/api/views/workspace.py @@ -223,6 +223,7 @@ class InviteWorkspaceEndpoint(BaseAPIView): algorithm="HS256", ), role=email.get("role", 10), + created_by=request.user, ) ) except ValidationError: @@ -381,6 +382,7 @@ class UserWorkspaceInvitationsEndpoint(BaseViewSet): workspace=invitation.workspace, member=request.user, role=invitation.role, + created_by=request.user, ) for invitation in workspace_invitations ], @@ -783,4 +785,3 @@ class WorkspaceThemeViewSet(BaseViewSet): {"error": "Something went wrong please try again later"}, status=status.HTTP_400_BAD_REQUEST, ) - diff --git a/apiserver/plane/bgtasks/importer_task.py b/apiserver/plane/bgtasks/importer_task.py index 291b71be3..27410966f 100644 --- a/apiserver/plane/bgtasks/importer_task.py +++ b/apiserver/plane/bgtasks/importer_task.py @@ -78,7 +78,11 @@ def service_importer(service, importer_id): # Add new users to Workspace and project automatically WorkspaceMember.objects.bulk_create( [ - WorkspaceMember(member=user, workspace_id=importer.workspace_id) + WorkspaceMember( + member=user, + workspace_id=importer.workspace_id, + created_by=importer.created_by, + ) for user in workspace_users ], batch_size=100, @@ -91,6 +95,7 @@ def service_importer(service, importer_id): project_id=importer.project_id, workspace_id=importer.workspace_id, member=user, + created_by=importer.created_by, ) for user in workspace_users ],