This commit is contained in:
parent
65818c2f40
commit
4e2cfb8637
|
@ -26,13 +26,12 @@ export default {
|
|||
left join tags on tags.id = tags_assign.tag_id
|
||||
left join favorites on favorites.item_id = items.id
|
||||
left join "user" on "user".id = favorites.user_id
|
||||
left join user_alias on user_alias.alias = lower("items".username)
|
||||
where
|
||||
${ db.unsafe(modequery) }
|
||||
and items.active = 'true'
|
||||
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
|
||||
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
|
||||
${ !o.fav && user ? db`and (items.username ilike ${'%'+user+'%'} or items.username ilike user_alias.alias)` : db`` }
|
||||
${ !o.fav && user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
|
||||
${ 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, tags.tag
|
||||
|
@ -60,14 +59,13 @@ export default {
|
|||
left join tags on tags.id = tags_assign.tag_id
|
||||
left join favorites on favorites.item_id = items.id
|
||||
left join "user" on "user".id = favorites.user_id
|
||||
left join user_alias on user_alias.alias = lower("items".username)
|
||||
left join tags_assign ta on ta.item_id = items.id and (ta.tag_id = 1 or ta.tag_id = 2)
|
||||
where
|
||||
${ db.unsafe(modequery) }
|
||||
and items.active = 'true'
|
||||
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
|
||||
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
|
||||
${ !o.fav && user ? db`and (items.username ilike ${'%'+user+'%'} or items.username ilike user_alias.alias)` : db`` }
|
||||
${ !o.fav && user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
|
||||
${ 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, tags.tag, ta.tag_id
|
||||
|
@ -123,14 +121,13 @@ export default {
|
|||
left join tags on tags.id = tags_assign.tag_id
|
||||
left join favorites on favorites.item_id = items.id
|
||||
left join "user" on "user".id = favorites.user_id
|
||||
left join user_alias on user_alias.alias = lower("items".username)
|
||||
left join tags_assign ta on ta.item_id = items.id and (ta.tag_id = 1 or ta.tag_id = 2)
|
||||
where
|
||||
${ db.unsafe(modequery) }
|
||||
and items.active = 'true'
|
||||
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
|
||||
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
|
||||
${ !o.fav && user ? db`and (items.username ilike ${'%'+user+'%'} or items.username ilike user_alias.alias)` : db`` }
|
||||
${ !o.fav && user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
|
||||
${ 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, tags.tag, ta.tag_id
|
||||
|
|
Loading…
Reference in New Issue
Block a user