[WEB-1983] fix: intake cycle and module operation and intake api updated (#5155)

* chore: added assignees and labels in the inbox api

* fix: intake issue cycle and module add operation

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
Bavisetti Narayan
2024-07-22 16:47:16 +05:30
committed by GitHub
parent c6909604b1
commit ae45ff158a
2 changed files with 40 additions and 3 deletions

View File

@@ -3,8 +3,11 @@ import json
# Django improts
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Q
from django.utils import timezone
from django.db.models import Q, Value, UUIDField
from django.db.models.functions import Coalesce
from django.contrib.postgres.aggregates import ArrayAgg
from django.contrib.postgres.fields import ArrayField
# Third party imports
from rest_framework import status
@@ -224,8 +227,27 @@ class InboxIssueAPIEndpoint(BaseAPIView):
issue_data = request.data.pop("issue", False)
if bool(issue_data):
issue = Issue.objects.get(
pk=issue_id, workspace__slug=slug, project_id=project_id
issue = Issue.objects.annotate(
label_ids=Coalesce(
ArrayAgg(
"labels__id",
distinct=True,
filter=~Q(labels__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
assignee_ids=Coalesce(
ArrayAgg(
"assignees__id",
distinct=True,
filter=~Q(assignees__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
).get(
pk=issue_id,
workspace__slug=slug,
project_id=project_id,
)
# Only allow guests and viewers to edit name and description
if project_member.role <= 10:

View File

@@ -176,6 +176,21 @@ export class InboxIssueStore implements IInboxIssueStore {
set(this.issue, issueKey, issue[issueKey]);
});
await this.issueService.patchIssue(this.workspaceSlug, this.projectId, this.issue.id, issue);
if (issue.cycle_id) {
await this.store.issue.issueDetail.addIssueToCycle(this.workspaceSlug, this.projectId, issue.cycle_id, [
this.issue.id,
]);
}
if (issue.module_ids) {
await this.store.issue.issueDetail.changeModulesInIssue(
this.workspaceSlug,
this.projectId,
this.issue.id,
issue.module_ids,
[]
);
}
// fetching activity
this.fetchIssueActivity();
} catch {