1
0
forked from w0bm/f0bm

potential fix for mixed random results when unathenticated

This commit is contained in:
x
2026-01-23 22:00:49 +01:00
parent 6692f32c4b
commit 03f2630090
2 changed files with 13 additions and 1 deletions

View File

@@ -226,10 +226,15 @@ export default {
from favorites
inner join items on favorites.item_id = items.id
inner join "user" on "user".id = favorites.user_id
left join tags_assign on tags_assign.item_id = items.id
left join tags on tags.id = tags_assign.tag_id
where
"user".user ilike ${'%' + user + '%'}
${db.unsafe(modequery)}
and "user".user ilike ${'%' + user + '%'}
and items.active = 'true'
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id
order by random()
limit 1
`;