From 540c6fb583c48580afbd4a47ee426a53ab44e87d Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Tue, 29 May 2018 23:20:57 +0200
Subject: [PATCH] Fixed #240: ignored page_size paremeter on artist and
 favorites list

---
 api/funkwhale_api/common/pagination.py  | 2 +-
 api/funkwhale_api/favorites/views.py    | 7 -------
 changes/changelog.d/240.bugfix          | 1 +
 front/src/components/favorites/List.vue | 4 ----
 4 files changed, 2 insertions(+), 12 deletions(-)
 create mode 100644 changes/changelog.d/240.bugfix

diff --git a/api/funkwhale_api/common/pagination.py b/api/funkwhale_api/common/pagination.py
index 224c470d..20efcb74 100644
--- a/api/funkwhale_api/common/pagination.py
+++ b/api/funkwhale_api/common/pagination.py
@@ -3,4 +3,4 @@ from rest_framework.pagination import PageNumberPagination
 
 class FunkwhalePagination(PageNumberPagination):
     page_size_query_param = 'page_size'
-    max_page_size = 25
+    max_page_size = 50
diff --git a/api/funkwhale_api/favorites/views.py b/api/funkwhale_api/favorites/views.py
index d874c9e1..cd2aa3b6 100644
--- a/api/funkwhale_api/favorites/views.py
+++ b/api/funkwhale_api/favorites/views.py
@@ -12,12 +12,6 @@ from . import models
 from . import serializers
 
 
-class CustomLimitPagination(pagination.PageNumberPagination):
-    page_size = 100
-    page_size_query_param = 'page_size'
-    max_page_size = 100
-
-
 class TrackFavoriteViewSet(mixins.CreateModelMixin,
                            mixins.DestroyModelMixin,
                            mixins.ListModelMixin,
@@ -26,7 +20,6 @@ class TrackFavoriteViewSet(mixins.CreateModelMixin,
     serializer_class = serializers.UserTrackFavoriteSerializer
     queryset = (models.TrackFavorite.objects.all())
     permission_classes = [ConditionalAuthentication]
-    pagination_class = CustomLimitPagination
 
     def create(self, request, *args, **kwargs):
         serializer = self.get_serializer(data=request.data)
diff --git a/changes/changelog.d/240.bugfix b/changes/changelog.d/240.bugfix
new file mode 100644
index 00000000..69e8048b
--- /dev/null
+++ b/changes/changelog.d/240.bugfix
@@ -0,0 +1 @@
+Fixed ignored page_size paremeter on artist and favorites list (#240)
diff --git a/front/src/components/favorites/List.vue b/front/src/components/favorites/List.vue
index 120aae2a..65d97cef 100644
--- a/front/src/components/favorites/List.vue
+++ b/front/src/components/favorites/List.vue
@@ -136,19 +136,15 @@ export default {
   watch: {
     page: function () {
       this.updateQueryString()
-      this.fetchFavorites(FAVORITES_URL)
     },
     paginateBy: function () {
       this.updateQueryString()
-      this.fetchFavorites(FAVORITES_URL)
     },
     orderingDirection: function () {
       this.updateQueryString()
-      this.fetchFavorites(FAVORITES_URL)
     },
     ordering: function () {
       this.updateQueryString()
-      this.fetchFavorites(FAVORITES_URL)
     }
   }
 }
-- 
GitLab