mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: bug fixes (#2609)
* chore: sub issue activity task * fix: mentions and issue comment * chore: added string for issue * chore: changed sub issue id
This commit is contained in:
parent
da391064aa
commit
caca2bb548
@ -773,6 +773,20 @@ class SubIssuesEndpoint(BaseAPIView):
|
|||||||
|
|
||||||
updated_sub_issues = Issue.issue_objects.filter(id__in=sub_issue_ids)
|
updated_sub_issues = Issue.issue_objects.filter(id__in=sub_issue_ids)
|
||||||
|
|
||||||
|
# Track the issue
|
||||||
|
_ = [
|
||||||
|
issue_activity.delay(
|
||||||
|
type="issue.activity.updated",
|
||||||
|
requested_data=json.dumps({"parent": str(issue_id)}),
|
||||||
|
actor_id=str(request.user.id),
|
||||||
|
issue_id=str(sub_issue_id),
|
||||||
|
project_id=str(project_id),
|
||||||
|
current_instance=json.dumps({"parent": str(sub_issue_id)}),
|
||||||
|
epoch=int(timezone.now().timestamp()),
|
||||||
|
)
|
||||||
|
for sub_issue_id in sub_issue_ids
|
||||||
|
]
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
IssueFlatSerializer(updated_sub_issues, many=True).data,
|
IssueFlatSerializer(updated_sub_issues, many=True).data,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
|
@ -131,7 +131,7 @@ def track_parent(
|
|||||||
else "",
|
else "",
|
||||||
field="parent",
|
field="parent",
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace=workspace_id,
|
workspace_id=workspace_id,
|
||||||
comment=f"updated the parent issue to",
|
comment=f"updated the parent issue to",
|
||||||
old_identifier=old_parent.id if old_parent is not None else None,
|
old_identifier=old_parent.id if old_parent is not None else None,
|
||||||
new_identifier=new_parent.id if new_parent is not None else None,
|
new_identifier=new_parent.id if new_parent is not None else None,
|
||||||
@ -334,9 +334,7 @@ def track_assignees(
|
|||||||
issue_activities,
|
issue_activities,
|
||||||
epoch,
|
epoch,
|
||||||
):
|
):
|
||||||
requested_assignees = set(
|
requested_assignees = set([str(asg) for asg in requested_data.get("assignees", [])])
|
||||||
[str(asg) for asg in requested_data.get("assignees", [])]
|
|
||||||
)
|
|
||||||
current_assignees = set([str(asg) for asg in current_instance.get("assignees", [])])
|
current_assignees = set([str(asg) for asg in current_instance.get("assignees", [])])
|
||||||
|
|
||||||
added_assignees = requested_assignees - current_assignees
|
added_assignees = requested_assignees - current_assignees
|
||||||
@ -363,6 +361,7 @@ def track_assignees(
|
|||||||
for dropped_assignee in dropped_assginees:
|
for dropped_assignee in dropped_assginees:
|
||||||
assignee = User.objects.get(pk=dropped_assignee)
|
assignee = User.objects.get(pk=dropped_assignee)
|
||||||
issue_activities.append(
|
issue_activities.append(
|
||||||
|
IssueActivity(
|
||||||
issue_id=issue_id,
|
issue_id=issue_id,
|
||||||
actor_id=actor_id,
|
actor_id=actor_id,
|
||||||
verb="updated",
|
verb="updated",
|
||||||
@ -375,6 +374,7 @@ def track_assignees(
|
|||||||
old_identifier=assignee.id,
|
old_identifier=assignee.id,
|
||||||
epoch=epoch,
|
epoch=epoch,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def track_estimate_points(
|
def track_estimate_points(
|
||||||
@ -1536,7 +1536,7 @@ def issue_activity(
|
|||||||
cls=DjangoJSONEncoder,
|
cls=DjangoJSONEncoder,
|
||||||
),
|
),
|
||||||
requested_data=requested_data,
|
requested_data=requested_data,
|
||||||
current_instance=current_instance
|
current_instance=current_instance,
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -5,7 +5,16 @@ import json
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
from plane.db.models import IssueMention, IssueSubscriber, Project, User, IssueAssignee, Issue, Notification
|
from plane.db.models import (
|
||||||
|
IssueMention,
|
||||||
|
IssueSubscriber,
|
||||||
|
Project,
|
||||||
|
User,
|
||||||
|
IssueAssignee,
|
||||||
|
Issue,
|
||||||
|
Notification,
|
||||||
|
IssueComment,
|
||||||
|
)
|
||||||
|
|
||||||
# Third Party imports
|
# Third Party imports
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
@ -165,6 +174,9 @@ def notifications(type, issue_id, project_id, actor_id, subscriber, issue_activi
|
|||||||
|
|
||||||
for subscriber in list(set(issue_subscribers)):
|
for subscriber in list(set(issue_subscribers)):
|
||||||
for issue_activity in issue_activities_created:
|
for issue_activity in issue_activities_created:
|
||||||
|
issue_comment = issue_activity.get("issue_comment")
|
||||||
|
if issue_comment is not None:
|
||||||
|
issue_comment = IssueComment.objects.get(id=issue_comment, issue_id=issue_id, project_id=project_id, workspace_id=project.workspace_id)
|
||||||
bulk_notifications.append(
|
bulk_notifications.append(
|
||||||
Notification(
|
Notification(
|
||||||
workspace=project.workspace,
|
workspace=project.workspace,
|
||||||
@ -192,8 +204,7 @@ def notifications(type, issue_id, project_id, actor_id, subscriber, issue_activi
|
|||||||
"new_value": str(issue_activity.get("new_value")),
|
"new_value": str(issue_activity.get("new_value")),
|
||||||
"old_value": str(issue_activity.get("old_value")),
|
"old_value": str(issue_activity.get("old_value")),
|
||||||
"issue_comment": str(
|
"issue_comment": str(
|
||||||
issue_activity.get(
|
issue_comment.comment_stripped
|
||||||
"issue_comment").comment_stripped
|
|
||||||
if issue_activity.get("issue_comment") is not None
|
if issue_activity.get("issue_comment") is not None
|
||||||
else ""
|
else ""
|
||||||
),
|
),
|
||||||
@ -257,7 +268,7 @@ def notifications(type, issue_id, project_id, actor_id, subscriber, issue_activi
|
|||||||
IssueMention.objects.bulk_create(
|
IssueMention.objects.bulk_create(
|
||||||
aggregated_issue_mentions, batch_size=100)
|
aggregated_issue_mentions, batch_size=100)
|
||||||
IssueMention.objects.filter(
|
IssueMention.objects.filter(
|
||||||
issue=issue.id, mention__in=removed_mention).delete()
|
issue=issue, mention__in=removed_mention).delete()
|
||||||
|
|
||||||
# Bulk create notifications
|
# Bulk create notifications
|
||||||
Notification.objects.bulk_create(bulk_notifications, batch_size=100)
|
Notification.objects.bulk_create(bulk_notifications, batch_size=100)
|
||||||
|
Loading…
Reference in New Issue
Block a user