From bcac31678503111cc579cce6634f2d2e5d8724bf Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 24 May 2023 13:38:37 -0700 Subject: [PATCH] Fix gallery filters re: inner circle photos --- pkg/models/photo.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkg/models/photo.go b/pkg/models/photo.go index 30c1eb2..db0c4fa 100644 --- a/pkg/models/photo.go +++ b/pkg/models/photo.go @@ -239,9 +239,20 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot ) // Define "all photos visibilities" - var photosAll = PhotoVisibilityAll + var ( + photosAll = PhotoVisibilityAll + photosPublic = []PhotoVisibility{ + PhotoPublic, + } + photosFriends = []PhotoVisibility{ + PhotoPublic, + PhotoFriends, + } + ) if user.IsInnerCircle() { photosAll = PhotoVisibilityCircle + photosPublic = append(photosPublic, PhotoInnerCircle) + photosFriends = append(photosFriends, PhotoInnerCircle) } // Admins see everything on the site (only an admin user can get an admin view). @@ -267,12 +278,12 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot wheres = append(wheres, "((user_id IN ? AND visibility IN ?) OR "+ "(user_id IN ? AND visibility IN ?) OR "+ - "(user_id NOT IN ? AND visibility = ?))", + "(user_id NOT IN ? AND visibility IN ?))", ) placeholders = append(placeholders, - friendIDs, PhotoVisibilityFriends, + friendIDs, photosFriends, privateUserIDs, photosAll, - friendIDs, PhotoPublic, + friendIDs, photosPublic, ) }