fix: validation for issue activity description (#1887)

This commit is contained in:
Bavisetti Narayan 2023-08-16 17:12:09 +05:30 committed by GitHub
parent 10dface85d
commit b24622e5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,19 +184,24 @@ def track_description(
if current_instance.get("description_html") != requested_data.get( if current_instance.get("description_html") != requested_data.get(
"description_html" "description_html"
): ):
issue_activities.append( last_activity = IssueActivity.objects.filter(issue_id=issue_id).order_by("-created_at").first()
IssueActivity( if(last_activity is not None and last_activity.field == "description" and actor.id == last_activity.actor_id):
issue_id=issue_id, last_activity.created_at = timezone.now()
actor=actor, last_activity.save(update_fields=["created_at"])
verb="updated", else:
old_value=current_instance.get("description_html"), issue_activities.append(
new_value=requested_data.get("description_html"), IssueActivity(
field="description", issue_id=issue_id,
project=project, actor=actor,
workspace=project.workspace, verb="updated",
comment=f"updated the description to {requested_data.get('description_html')}", old_value=current_instance.get("description_html"),
) new_value=requested_data.get("description_html"),
) field="description",
project=project,
workspace=project.workspace,
comment=f"updated the description to {requested_data.get('description_html')}",
)
)
# Track changes in issue target date # Track changes in issue target date