mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: remove extra keys from users endpoint
This commit is contained in:
parent
2b46e5f977
commit
d5344d6fb3
@ -34,12 +34,6 @@ class UserEndpoint(BaseViewSet):
|
|||||||
workspace = Workspace.objects.get(
|
workspace = Workspace.objects.get(
|
||||||
pk=request.user.last_workspace_id, workspace_member__member=request.user
|
pk=request.user.last_workspace_id, workspace_member__member=request.user
|
||||||
)
|
)
|
||||||
workspace_invites = WorkspaceMemberInvite.objects.filter(
|
|
||||||
email=request.user.email
|
|
||||||
).count()
|
|
||||||
assigned_issues = Issue.issue_objects.filter(
|
|
||||||
assignees__in=[request.user]
|
|
||||||
).count()
|
|
||||||
|
|
||||||
serialized_data = UserSerializer(request.user).data
|
serialized_data = UserSerializer(request.user).data
|
||||||
serialized_data["workspace"] = {
|
serialized_data["workspace"] = {
|
||||||
@ -47,11 +41,7 @@ class UserEndpoint(BaseViewSet):
|
|||||||
"last_workspace_slug": workspace.slug,
|
"last_workspace_slug": workspace.slug,
|
||||||
"fallback_workspace_id": request.user.last_workspace_id,
|
"fallback_workspace_id": request.user.last_workspace_id,
|
||||||
"fallback_workspace_slug": workspace.slug,
|
"fallback_workspace_slug": workspace.slug,
|
||||||
"invites": workspace_invites,
|
|
||||||
}
|
}
|
||||||
serialized_data.setdefault("issues", {})[
|
|
||||||
"assigned_issues"
|
|
||||||
] = assigned_issues
|
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
serialized_data,
|
serialized_data,
|
||||||
@ -60,13 +50,6 @@ class UserEndpoint(BaseViewSet):
|
|||||||
except Workspace.DoesNotExist:
|
except Workspace.DoesNotExist:
|
||||||
# This exception will be hit even when the `last_workspace_id` is None
|
# This exception will be hit even when the `last_workspace_id` is None
|
||||||
|
|
||||||
workspace_invites = WorkspaceMemberInvite.objects.filter(
|
|
||||||
email=request.user.email
|
|
||||||
).count()
|
|
||||||
assigned_issues = Issue.issue_objects.filter(
|
|
||||||
assignees__in=[request.user]
|
|
||||||
).count()
|
|
||||||
|
|
||||||
fallback_workspace = (
|
fallback_workspace = (
|
||||||
Workspace.objects.filter(workspace_member__member=request.user)
|
Workspace.objects.filter(workspace_member__member=request.user)
|
||||||
.order_by("created_at")
|
.order_by("created_at")
|
||||||
@ -84,11 +67,7 @@ class UserEndpoint(BaseViewSet):
|
|||||||
"fallback_workspace_slug": fallback_workspace.slug
|
"fallback_workspace_slug": fallback_workspace.slug
|
||||||
if fallback_workspace is not None
|
if fallback_workspace is not None
|
||||||
else None,
|
else None,
|
||||||
"invites": workspace_invites,
|
|
||||||
}
|
}
|
||||||
serialized_data.setdefault("issues", {})[
|
|
||||||
"assigned_issues"
|
|
||||||
] = assigned_issues
|
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
serialized_data,
|
serialized_data,
|
||||||
@ -102,6 +81,7 @@ class UserEndpoint(BaseViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateUserOnBoardedEndpoint(BaseAPIView):
|
class UpdateUserOnBoardedEndpoint(BaseAPIView):
|
||||||
def patch(self, request):
|
def patch(self, request):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user