From 3ef38fabdbc7d2560e61ebb343961c116c3e194d Mon Sep 17 00:00:00 2001 From: thomas girod Date: Fri, 9 Aug 2024 17:34:35 +0200 Subject: [PATCH 1/3] fix picture navigation --- sas/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sas/views.py b/sas/views.py index 399f9360..575448e0 100644 --- a/sas/views.py +++ b/sas/views.py @@ -181,7 +181,9 @@ class PictureView(CanViewMixin, DetailView, FormMixin): def get_context_data(self, **kwargs): kwargs = super().get_context_data(**kwargs) - pictures_qs = Picture.objects.viewable_by(self.request.user) + pictures_qs = Picture.objects.filter( + parent_id=self.object.parent_id + ).viewable_by(self.request.user) kwargs["form"] = self.form kwargs["next_pict"] = ( pictures_qs.filter(id__gt=self.object.id).order_by("id").first() From c56d6e3f6b625a1dfc3d2904ce1f2cacc16690ac Mon Sep 17 00:00:00 2001 From: thomas girod Date: Fri, 9 Aug 2024 17:35:33 +0200 Subject: [PATCH 2/3] fix wrong page size when fetching pictures. --- core/templates/core/user_pictures.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index c3815552..e39e7c72 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -94,7 +94,7 @@ from paginated routes. In order to download all the user pictures, it may be needed to performs multiple requests #} - const max_per_page = 1; + const max_per_page = 199; const url = "{{ url("api:pictures") }}" + "?users_identified={{ object.id }}" + `&page_size=${max_per_page}`; From 9163e4dee6f5ce5b5caaf4de699432757e6ab9a9 Mon Sep 17 00:00:00 2001 From: thomas girod Date: Fri, 9 Aug 2024 18:06:58 +0200 Subject: [PATCH 3/3] fix SAS album display --- sas/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sas/models.py b/sas/models.py index cbb669e6..5b6467f5 100644 --- a/sas/models.py +++ b/sas/models.py @@ -175,6 +175,16 @@ class AlbumQuerySet(models.QuerySet): """ if user.is_root or user.is_in_group(pk=settings.SITH_GROUP_SAS_ADMIN_ID): return self.all() + if user.was_subscribed: + return self.filter(moderated=True) + # known bug : if all children of an album are also albums + # then this album is excluded, even if one of the sub-albums should be visible. + # The fs-like navigation is likely to be half-broken for non-subscribers, + # but that's ok, since non-subscribers are expected to see only the albums + # containing pictures on which they have been identified (hence, very few). + # Most, if not all, of their albums will be displayed on the + # `latest albums` section of the SAS. + # Moreover, they will still see all of their picture in their profile. return self.filter( Exists(Picture.objects.filter(parent_id=OuterRef("pk")).viewable_by(user)) )