Fix gallery filters re: inner circle photos

This commit is contained in:
Noah Petherbridge 2023-05-24 13:38:37 -07:00
parent eccc4f0044
commit bcac316785

View File

@ -239,9 +239,20 @@ func PaginateGalleryPhotos(user *User, conf Gallery, pager *Pagination) ([]*Phot
) )
// Define "all photos visibilities" // Define "all photos visibilities"
var photosAll = PhotoVisibilityAll var (
photosAll = PhotoVisibilityAll
photosPublic = []PhotoVisibility{
PhotoPublic,
}
photosFriends = []PhotoVisibility{
PhotoPublic,
PhotoFriends,
}
)
if user.IsInnerCircle() { if user.IsInnerCircle() {
photosAll = PhotoVisibilityCircle 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). // 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, wheres = append(wheres,
"((user_id IN ? AND visibility IN ?) OR "+ "((user_id IN ? AND visibility IN ?) OR "+
"(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, placeholders = append(placeholders,
friendIDs, PhotoVisibilityFriends, friendIDs, photosFriends,
privateUserIDs, photosAll, privateUserIDs, photosAll,
friendIDs, PhotoPublic, friendIDs, photosPublic,
) )
} }