chore: user activity in profile page (#2856)

* chore: user activity endpoint change

* chore: added workspace detail in activity serializer
This commit is contained in:
Bavisetti Narayan 2023-11-23 21:00:49 +05:30 committed by sriram veeraghanta
parent 910bd11e86
commit 86de38d3a0
3 changed files with 4 additions and 3 deletions

View File

@ -225,6 +225,7 @@ class IssueActivitySerializer(BaseSerializer):
actor_detail = UserLiteSerializer(read_only=True, source="actor") actor_detail = UserLiteSerializer(read_only=True, source="actor")
issue_detail = IssueFlatSerializer(read_only=True, source="issue") issue_detail = IssueFlatSerializer(read_only=True, source="issue")
project_detail = ProjectLiteSerializer(read_only=True, source="project") project_detail = ProjectLiteSerializer(read_only=True, source="project")
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")
class Meta: class Meta:
model = IssueActivity model = IssueActivity

View File

@ -63,7 +63,7 @@ urlpatterns = [
name="user-tour", name="user-tour",
), ),
path( path(
"users/workspaces/<str:slug>/activities/", "users/me/activities/",
UserActivityEndpoint.as_view(), UserActivityEndpoint.as_view(),
name="user-activities", name="user-activities",
), ),

View File

@ -76,9 +76,9 @@ class UpdateUserTourCompletedEndpoint(BaseAPIView):
class UserActivityEndpoint(BaseAPIView, BasePaginator): class UserActivityEndpoint(BaseAPIView, BasePaginator):
def get(self, request, slug): def get(self, request):
queryset = IssueActivity.objects.filter( queryset = IssueActivity.objects.filter(
actor=request.user, workspace__slug=slug actor=request.user
).select_related("actor", "workspace", "issue", "project") ).select_related("actor", "workspace", "issue", "project")
return self.paginate( return self.paginate(