From 71f9ae41f3e3a9985349722b5aed4d352096d5e0 Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:50:54 +0530 Subject: [PATCH] feat: created_by details for links (#313) --- apiserver/plane/api/serializers/issue.py | 3 +++ apiserver/plane/api/views/issue.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apiserver/plane/api/serializers/issue.py b/apiserver/plane/api/serializers/issue.py index c501a3d94..95c3f5827 100644 --- a/apiserver/plane/api/serializers/issue.py +++ b/apiserver/plane/api/serializers/issue.py @@ -461,6 +461,9 @@ class IssueModuleDetailSerializer(BaseSerializer): class IssueLinkSerializer(BaseSerializer): + + created_by_detail = UserLiteSerializer(read_only=True, source="created_by") + class Meta: model = IssueLink fields = "__all__" diff --git a/apiserver/plane/api/views/issue.py b/apiserver/plane/api/views/issue.py index 4f7e7473b..4c5b788a6 100644 --- a/apiserver/plane/api/views/issue.py +++ b/apiserver/plane/api/views/issue.py @@ -138,7 +138,9 @@ class IssueViewSet(BaseViewSet): .prefetch_related( Prefetch( "issue_link", - queryset=IssueLink.objects.select_related("issue"), + queryset=IssueLink.objects.select_related("issue").select_related( + "created_by" + ), ) ) ) @@ -273,7 +275,9 @@ class UserWorkSpaceIssues(BaseAPIView): .prefetch_related( Prefetch( "issue_link", - queryset=IssueLink.objects.select_related("issue"), + queryset=IssueLink.objects.select_related( + "issue" + ).select_related("created_by"), ) ) )