Skip to content

Commit

Permalink
chore: added is_favorite filter (#1518)
Browse files Browse the repository at this point in the history
* fix: notification filtering

* dev: reverse logic for archive filtering

* dev: fix watching notification

* dev: read filter

* dev: update automatic issue archival and close to send notifications

* dev: update archival structure for auto close issues

* chore: added is_favorite filter

* fix: removed the unwanted filter

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
  • Loading branch information
NarayanBavisetti and pablohashescobar committed Jul 13, 2023
1 parent 864e592 commit a829e6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion apiserver/plane/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@
"workspaces/<str:slug>/user-favorite-projects/",
ProjectFavoritesViewSet.as_view(
{
"get": "list",
"post": "create",
}
),
Expand Down
7 changes: 7 additions & 0 deletions apiserver/plane/api/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def get_queryset(self):

def list(self, request, slug):
try:
is_favorite = request.GET.get("is_favorite", "all")
subquery = ProjectFavorite.objects.filter(
user=self.request.user,
project_id=OuterRef("pk"),
Expand Down Expand Up @@ -126,6 +127,12 @@ def list(self, request, slug):
.values("count")
)
)

if is_favorite == "true":
projects = projects.filter(is_favorite=True)
if is_favorite == "false":
projects = projects.filter(is_favorite=False)

return Response(ProjectDetailSerializer(projects, many=True).data)
except Exception as e:
capture_exception(e)
Expand Down

1 comment on commit a829e6f

@vercel
Copy link

@vercel vercel bot commented on a829e6f Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./apps/app

plane-dev-git-develop-plane.vercel.app
plane-dev-plane.vercel.app
plane-dev.vercel.app

Please sign in to comment.