fix: gallery tag filters and tag-cleanup are empty in single-user mode (#1771)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:23:08 +01:00
committed by GitHub
parent d25a860f71
commit bde5f6adb3
2 changed files with 66 additions and 2 deletions
+10 -2
View File
@@ -110,9 +110,17 @@ def _image_to_dict(img: GalleryImage, session_name: str = None) -> Dict[str, Any
def _owner_filter(q, user):
"""Apply owner filtering to a gallery query."""
"""Apply owner filtering to a gallery query.
When auth is disabled (single-user mode) get_current_user returns None
and there is no per-user scoping. The main library list and stats already
treat None as "show everything" (`if user is not None`), so this helper
must too — otherwise the tag/model filter sidebars come back empty and the
tag-cleanup endpoints (clear-user-tags, clear-ai-tags, dedupe-tags)
silently affect zero rows in the most common self-hosted deployment.
"""
if user is None:
return q.filter(False)
return q
return q.filter(GalleryImage.owner == user)