f0ckv2 specifics

This commit is contained in:
2026-07-18 12:22:51 +02:00
parent a8af6427eb
commit 2a5f8288d2
3 changed files with 7 additions and 1 deletions

View File

@@ -1029,6 +1029,8 @@ export default {
and uha.hall_id = ${userHallId}
and items.active = true
${mimeSQL}
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``}
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``}
order by random()
limit 1
@@ -1056,6 +1058,7 @@ export default {
WHERE items.active = true
${mimeSQL}
${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``}
${!session && cfg.websrv.public_untagged === false ? db`AND EXISTS (SELECT 1 FROM tags_assign WHERE item_id = items.id)` : db``}
${excludedTags.length > 0 ? db`AND NOT EXISTS (SELECT 1 FROM tags_assign WHERE item_id = items.id AND tag_id = ANY(${excludedTags}::int[]))` : db``}
${!useTagIdOpt ? db`AND ${db.unsafe(globalModeQuery)}` : db``}
ORDER BY random()