[WEB-4665] fix: data import task to populate created_by and updated_by ids when saving data #3878

This commit is contained in:
Nikhil
2025-08-11 18:57:54 +05:30
committed by GitHub
parent da90f2e791
commit 773de57731

View File

@@ -199,6 +199,7 @@ def process_single_issue(slug, project, user_id, issue_data):
# Update the issue with the created_by_id
issue.created_by_id = issue_data.get("created_by")
issue.updated_by_id = issue_data.get("created_by")
issue.save(disable_auto_set_user=True)
# Process links
@@ -252,6 +253,8 @@ def process_issue_links(issue, links):
workspace_id=issue.workspace_id,
title=link_data["name"],
url=link_data["url"],
created_by_id=issue.created_by_id,
updated_by_id=issue.created_by_id,
)
)
@@ -300,6 +303,7 @@ def process_issue_comments(user_id, issue, comments):
existing_comment = existing_comments_map[external_id]
existing_comment.actor_id = comment_actor
existing_comment.created_by_id = comment_actor
existing_comment.updated_by_id = comment_actor
existing_comment.comment_html = comment_data["comment_html"]
bulk_update_comments.append(existing_comment)
else:
@@ -314,6 +318,7 @@ def process_issue_comments(user_id, issue, comments):
created_by_id=comment_actor,
external_id=external_id,
external_source=comment_data.get("external_source"),
updated_by_id=comment_actor,
)
bulk_create_comments.append(comment)
@@ -326,7 +331,7 @@ def process_issue_comments(user_id, issue, comments):
if bulk_update_comments:
IssueComment.objects.bulk_update(
bulk_update_comments,
["comment_html", "actor_id", "created_by_id"],
["comment_html", "actor_id", "created_by_id", "updated_by_id"],
batch_size=100,
)
@@ -366,6 +371,10 @@ def process_issue_cycles(issue, cycle_ids):
project_id=issue.project_id,
workspace_id=issue.workspace_id,
cycle_id=cycle_id,
defaults={
"created_by_id": issue.created_by_id,
"updated_by_id": issue.created_by_id,
},
)
return
@@ -378,6 +387,10 @@ def process_issue_modules(issue, module_ids):
project_id=issue.project_id,
workspace_id=issue.workspace_id,
module_id=module_id,
defaults={
"created_by_id": issue.created_by_id,
"updated_by_id": issue.created_by_id,
},
)
return
@@ -397,6 +410,8 @@ def process_comment_file_assets(comment, file_assets):
comment_id=comment.id,
project_id=comment.project_id,
workspace_id=comment.workspace_id,
created_by_id=comment.created_by_id,
updated_by_id=comment.updated_by_id,
)
return
@@ -416,6 +431,8 @@ def process_issue_file_assets(issue, file_assets):
issue_id=issue.id,
project_id=issue.project_id,
workspace_id=issue.workspace_id,
created_by_id=issue.created_by_id,
updated_by_id=issue.created_by_id,
)
return