photoprism/internal/search/albums_photos.go
Michael Mayer d8e0364dbb Search: Ignore public album filter if "Private" feat is disabled #2570
This needs to be very well tested and discussed, as these changes can
lead to private photos being accidentally published. Thank you!

Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-08-01 15:57:19 +02:00

33 lines
675 B
Go

package search
import (
"github.com/photoprism/photoprism/internal/entity"
"github.com/photoprism/photoprism/internal/form"
)
// AlbumPhotos returns up to count photos from an album.
func AlbumPhotos(a entity.Album, count int, shared bool) (results PhotoResults, err error) {
frm := form.SearchPhotos{
Album: a.AlbumUID,
Filter: a.AlbumFilter,
Count: count,
Offset: 0,
}
if shared {
frm.Public = true
frm.Private = false
frm.Hidden = false
frm.Archived = false
frm.Review = false
}
// Parse query string and filter.
if err = frm.ParseQueryString(); err != nil {
return results, err
}
results, _, err = Photos(frm)
return results, err
}