chore: added validation for archived issue

This commit is contained in:
NarayanBavisetti 2023-11-01 17:12:44 +05:30
parent d511799f31
commit 2b764163bf
3 changed files with 31 additions and 30 deletions

View File

@ -1100,7 +1100,7 @@ class IssueArchiveViewSet(BaseViewSet):
actor_id=str(request.user.id),
issue_id=str(issue.id),
project_id=str(project_id),
current_instance=None,
current_instance=json.dumps(IssueSerializer(issue).data, cls=DjangoJSONEncoder),
epoch=int(timezone.now().timestamp()),
)

View File

@ -418,36 +418,37 @@ def track_archive_at(
issue_activities,
epoch,
):
if requested_data.get("archived_at") is None:
issue_activities.append(
IssueActivity(
issue_id=issue_id,
project_id=project_id,
workspace_id=workspace_id,
comment=f"has restored the issue",
verb="updated",
actor_id=actor_id,
field="archived_at",
old_value="archive",
new_value="restore",
epoch=epoch,
if current_instance.get("archived_at") != requested_data.get("archived_at"):
if requested_data.get("archived_at") is None:
issue_activities.append(
IssueActivity(
issue_id=issue_id,
project_id=project_id,
workspace_id=workspace_id,
comment=f"has restored the issue",
verb="updated",
actor_id=actor_id,
field="archived_at",
old_value="archive",
new_value="restore",
epoch=epoch,
)
)
)
else:
issue_activities.append(
IssueActivity(
issue_id=issue_id,
project_id=project_id,
workspace_id=workspace_id,
comment=f"Plane has archived the issue",
verb="updated",
actor_id=actor_id,
field="archived_at",
old_value=None,
new_value="archive",
epoch=epoch,
else:
issue_activities.append(
IssueActivity(
issue_id=issue_id,
project_id=project_id,
workspace_id=workspace_id,
comment=f"Plane has archived the issue",
verb="updated",
actor_id=actor_id,
field="archived_at",
old_value=None,
new_value="archive",
epoch=epoch,
)
)
)
def track_closed_to(

View File

@ -78,7 +78,7 @@ def archive_old_issues():
actor_id=str(project.created_by_id),
issue_id=issue.id,
project_id=project_id,
current_instance=None,
current_instance=json.dumps({"archived_at": None}),
subscriber=False,
epoch=int(timezone.now().timestamp())
)