fix tags + slugify

This commit is contained in:
Flummi 2022-05-21 15:03:01 +00:00
parent 74431a2a29
commit d2091494a1

View File

@ -27,7 +27,7 @@ export default {
left join "user" on "user".id = favorites.user_id
where
${ db.unsafe(modequery) }
${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` }
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
${ mime ? db`and items.mime ilike ${smime}` : db`` }
@ -60,7 +60,7 @@ export default {
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) }
${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` }
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
${ mime ? db`and items.mime ilike ${smime}` : db`` }
@ -121,7 +121,7 @@ export default {
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) }
${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` }
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
${ mime ? db`and items.mime ilike ${smime}` : db`` }
@ -216,7 +216,7 @@ export default {
left join "user" on "user".id = favorites.user_id
where
${ db.unsafe(modequery) }
${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` }
${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` }
${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` }
${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` }
${ mime ? db`and items.mime ilike ${smime}` : db`` }