diff --git a/internal/config/client.go b/internal/config/client.go index ec997345b..618a370f6 100644 --- a/internal/config/client.go +++ b/internal/config/client.go @@ -192,7 +192,7 @@ func (c *Config) ClientConfig() ClientConfig { Take(&result.Count) c.Db().Table("photos"). - Select("SUM(photo_type = 'video' AND photo_quality >= 0 AND photo_private = 0) AS videos, SUM(photo_type IN ('image','raw','live') AND photo_quality < 3 AND photo_quality >= 0 AND photo_private = 0) AS review, SUM(photo_quality = -1) AS hidden, SUM(photo_type IN ('image','raw','live') AND photo_private = 0 AND photo_quality >= 0) AS photos, SUM(photo_favorite = 1 AND photo_quality >= 0) AS favorites, SUM(photo_private = 1 AND photo_quality >= 0) AS private"). + Select("SUM(photo_type = 'video' AND photo_quality >= 0 AND photo_private = 0) AS videos, SUM(photo_type IN ('image','raw','live') AND photo_quality < 3 AND photo_quality >= 0 AND photo_private = 0) AS review, SUM(photo_quality = -1) AS hidden, SUM(photo_type IN ('image','raw','live') AND photo_private = 0 AND photo_quality >= 0) AS photos, SUM(photo_favorite = 1 AND photo_private = 0 AND photo_quality >= 0) AS favorites, SUM(photo_private = 1 AND photo_quality >= 0) AS private"). Where("photos.id NOT IN (SELECT photo_id FROM files WHERE file_primary = 1 AND (file_missing = 1 OR file_error <> ''))"). Where("deleted_at IS NULL"). Take(&result.Count) diff --git a/internal/entity/photo.go b/internal/entity/photo.go index 0800c3da9..58d0e218a 100644 --- a/internal/entity/photo.go +++ b/internal/entity/photo.go @@ -801,7 +801,7 @@ func (m *Photo) SetFavorite(favorite bool) error { } // Update counters if changed and not deleted. - if changed && m.DeletedAt == nil { + if changed && m.PhotoPrivate == false && m.DeletedAt == nil { if favorite { event.Publish("count.favorites", event.Data{ "count": 1,