Search: Ignore deleted albums when using the "unsorted" filter #3051
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
727b3eb552
commit
449f9f8b83
|
@ -637,7 +637,7 @@ func searchPhotos(f form.SearchPhotos, sess *entity.Session, resultCols string)
|
||||||
// Find photos in albums or not in an album, unless search results are limited to a scope.
|
// Find photos in albums or not in an album, unless search results are limited to a scope.
|
||||||
if f.Scope == "" {
|
if f.Scope == "" {
|
||||||
if f.Unsorted {
|
if f.Unsorted {
|
||||||
s = s.Where("photos.photo_uid NOT IN (SELECT photo_uid FROM photos_albums pa WHERE pa.hidden = 0)")
|
s = s.Where("photos.photo_uid NOT IN (SELECT photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid WHERE pa.hidden = 0 AND a.deleted_at IS NULL)")
|
||||||
} else if txt.NotEmpty(f.Album) {
|
} else if txt.NotEmpty(f.Album) {
|
||||||
v := strings.Trim(f.Album, "*%") + "%"
|
v := strings.Trim(f.Album, "*%") + "%"
|
||||||
s = s.Where("photos.photo_uid IN (SELECT pa.photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid AND pa.hidden = 0 WHERE (a.album_title LIKE ? OR a.album_slug LIKE ?))", v, v)
|
s = s.Where("photos.photo_uid IN (SELECT pa.photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid AND pa.hidden = 0 WHERE (a.album_title LIKE ? OR a.album_slug LIKE ?))", v, v)
|
||||||
|
|
|
@ -329,7 +329,7 @@ func UserPhotosGeo(f form.SearchPhotosGeo, sess *entity.Session) (results GeoRes
|
||||||
// Find photos in albums or not in an album, unless search results are limited to a scope.
|
// Find photos in albums or not in an album, unless search results are limited to a scope.
|
||||||
if f.Scope == "" {
|
if f.Scope == "" {
|
||||||
if f.Unsorted {
|
if f.Unsorted {
|
||||||
s = s.Where("photos.photo_uid NOT IN (SELECT photo_uid FROM photos_albums pa WHERE pa.hidden = 0)")
|
s = s.Where("photos.photo_uid NOT IN (SELECT photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid WHERE pa.hidden = 0 AND a.deleted_at IS NULL)")
|
||||||
} else if txt.NotEmpty(f.Album) {
|
} else if txt.NotEmpty(f.Album) {
|
||||||
v := strings.Trim(f.Album, "*%") + "%"
|
v := strings.Trim(f.Album, "*%") + "%"
|
||||||
s = s.Where("photos.photo_uid IN (SELECT pa.photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid AND pa.hidden = 0 WHERE (a.album_title LIKE ? OR a.album_slug LIKE ?))", v, v)
|
s = s.Where("photos.photo_uid IN (SELECT pa.photo_uid FROM photos_albums pa JOIN albums a ON a.album_uid = pa.album_uid AND pa.hidden = 0 WHERE (a.album_title LIKE ? OR a.album_slug LIKE ?))", v, v)
|
||||||
|
|
Loading…
Reference in a new issue